1、Linux Apache环境(.htaccess):
<IfModule mod_rewrite.c> RewriteEngine On # 下面是在根目录,文件夹要修改路径,如 /laozuo/ RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L]
# 带 www 的跳转到不带的 RewriteCond %{HTTP_HOST} ^www.laozuo.org RewriteRule (.*) http://laozuo.org/$1 [R=301,L]
# 不带 www 的跳转到带的 RewriteCond %{HTTP_HOST} ^laozuo.org RewriteRule (.*) http://www.laozuo.org/$1 [R=301,L] </IfModule> |
2、Linux Apache环境(Nginx):