apache中上传.htaccess文件到根目录,内容如下:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
将上面的内容复制到记事本,另存为.htaccess即可。
typecho在nginx下的rewrite有好多方法
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下的 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 /category/(.*) /index.php/category/$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]