Codeigniter rewrite规则配置(apache)

第一步:修改apache配置文件。

DocumentRoot “E:/website”

Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

LoadModule rewrite_module modules/mod_rewrite.so

第二步:在站点根目录加.htaccess

RewriteEngine on
RewriteCond $1 !^(index.php|public|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

PS:如果用了rewrite,记得过滤你图片文件夹和样式文件夹,如我的站点的图片/样式/脚本的文件夹分别为images/css/js,.htaccess文件第行的内容改为RewriteCond $1 !^(index.php|images|css|js|public|robots.txt)

discuz X2.5 rewrite 伪静态linux .htaccess文件设置 apache专用

# 将 RewriteEngine 模式打开
RewriteEngine On
# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /
# Rewrite 系统规则请勿修改
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+).html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+).html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(w+)-([0-9]+).html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html$ forum.php?mod=viewthread&tid=$1&extra=page%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+).html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+).html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+)-(.+).html$ $1.php?rewrite=$2&%1