Ravo's Blog - 伪静态规则
type: channel
link: https://www.ravo.top/tag/%E4%BC%AA%E9%9D%99%E6%80%81%E8%A7%84%E5%88%99/
items: Typecho程序伪静态规则大全

Typecho程序伪静态规则大全
type: item
date: 2021-03-03T22:36:00+08:00
description: Typecho程序的伪静态规则不同于wp直接默认可用，需要我们手工加载到空间中才可以生效。这里整理了一些不同的主机环境中的伪静态规则，希望对大家有所帮助！1、Linux Apache环境(.htaccess)下面是在根目录，如果不在根目录文件夹需要修改路径，如 /sub/ RewriteEngine On # 下面是在根目录，文件夹要修改路径 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] 带 www 的跳转到不带的RewriteCond %{HTTP_HOST} ^www.ravo.top RewriteRule (.*) https://ravo.top/$1 [R=301,L]不带 www 的跳转到带的RewriteCond %{HTTP_HOST} ^ravo.top RewriteRule (.*) https://www.ravo.top/t/$1 [R=301,L]2、Linux Apache环境（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; } }3、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]