Apache .与codeigniter设置相关的htaccess问题
所以我对.htaccess重写相当不在行 目前,这是我的codeigniter设置的设置:Apache .与codeigniter设置相关的htaccess问题,apache,.htaccess,url-rewriting,Apache,.htaccess,Url Rewriting,所以我对.htaccess重写相当不在行 目前,这是我的codeigniter设置的设置: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] 当我将所有内容重写到index.php时,
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
当我将所有内容重写到index.php时,这一切都很好。问题是,我正试图在www.site.com/forums/上安装一个论坛,当然这不起作用,因为它将其重写为main index.php
有什么建议吗?这是我使用的CodeIgniter.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^public.*
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
规则应防止将现有文件或目录重写为index.php,但也可以复制
RewriteCond %{REQUEST_URI} !^public.*
规则是
RewriteCond %{REQUEST_URI} !^forums.*
在你的情况下,它应该实现同样的目标
RewriteCond %{REQUEST_URI} !^forums.*