typecho伪静态去后台设置永久链接即可,但设置后会发现地址后面带有index.php尾巴,那怎么把这个尾巴也给去除呢?只需要在永久链接那里开启地址重写功能即可,但会出现一些错误导致不成功,可以使用以下的方法配置。

nginx设置

server {
        listen          80;
        server_name     yourdomain.com;
        root            /home/yourdomain/www/;
        index           index.html index.htm index.php;

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ .*\.php(\/.*)*$ {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
        }

        access_log logs/yourdomain.log combined;
    }

apache设置

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

</IfModule>

虚拟空间请放在.htaccess文件中,或者放在apache的conf中。

设置好后刷新网站看看是不是去除了index!

流量卡推广
Last modification:August 16, 2018