本文编写于 1578 天前,最后修改于 1578 天前,其中某些信息可能已经过时。
终于不用放上那个index.php的后缀了
如何操作
apache 服务器
.htaccess
文件,放到typecho根目录
<IfModule mod_rewrite.c>
RewriteEngine On
# 下面是在根目录,文件夹要修改路径
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
nginx
location / {
index index.html index.php;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php;
}
if (!-f $request_filename) {
rewrite (.*) /index.php;
}
}
Windows IIS伪静态(httpd.ini)
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# 中文tag解决
RewriteRule /tag/(.*) /index\.php\?tag=$1
# sitemapxml
RewriteRule /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# 内容页
RewriteRule /(.*).html /index.php/$1.html [L]
# 评论
RewriteRule /(.*)/comment /index.php/$1/comment [L]
# 分类页
RewriteRule /category/(.*) /index.php/category/$1 [L]
# 分页
RewriteRule /page/(.*) /index.php/page/$1 [L]
# 搜索页
RewriteRule /search/(.*) /index.php/search/$1 [L]
# feed
RewriteRule /feed/(.*) /index.php/feed/$1 [L]
# 日期归档
RewriteRule /2(.*) /index.php/2$1 [L]
# 上传图片等
RewriteRule /action(.*) /index.php/action$1 [L]
然后typecho后台强制开启伪静态就行了,之前试了一直没成功,今天成功了hhh
今天话说搞了几个小实验室,过几天放上来
Wp没注意过伪静态问题,固定后台地址就行了
Blockchain 2020-01-12 22:56
真的是的,用wp就不用担心这个问题,是不是安装wp的时候就要检测目录权限的原因?这使得wp可以直接覆盖这个htaccess。我用typecho的时候发现必须手动改哈哈哈,于是写了这个,常来玩哈
Yugo 2020-01-13 09:23
伪静态还是挺好的
森纯博客 2020-01-11 00:17
哈哈,之前设置过,总是会报错,然后看到别的博主说不管报错强制覆盖就行,这次试了试,果真可以了!嘿嘿,常来玩哦
Yugo 2020-01-11 13:16