Typecho默认的后台网址是这样:http://note.coccoo.cc/index.php/diary/23.html
但我想让它的形式是这样:http://note.coccoo.cc/diary/23.html
该怎么做呢?
后台配置伪静态
配置服务器的rewrite规则
如果在保存上述配置的时候,typecho无法自动配置(提示错误),那么你可能需要手动配置服务器的rewrite规则。
nginx配置
server {
listen 80;
server_name note.coccoo.cc; #你的网站域名
index index.html index.htm index.php;
root /home/www/typecho; #网站路径
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
#include fastcgi.conf;
#fastcgi_pass 127.0.0.1:9000;
}
location ~ \.php(\/.*)*$ {
#try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
如果还有问题,请参考:http://docs.typecho.org/servers?s%5B%5D=nginx
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>
此配置可以放在apache的conf文件中,或者放在.htaccess中。
评论 (0)