2013-05-01 56 views
1

我似乎无法让我的.htaccess的工作,我试图重写不是真正的文件或文件夹到我的index.php所有URL。我在该目录是/ CMS改写似乎只能在工作的时候使用这个的.htaccessRewriteBase没有被应用

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /cms/index.php [L] 
</IfModule> 

当我尝试使用RewriteBase/CMS /并更改最后一行。的index.php [L]喜欢它的意思是,重写不重写到localhost/CMS/index.php文件,而是它被改写为localhost/index.php的

回答

1

尝试使用这个版本:

RewriteEngine On 
RewriteBase /cms/ 

RewriteRule ^index\.php$ - [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L] 

请注意,我使用index.php而不是/index.php与RewriteBase来确保加载相对URI。

+0

完美的作品,我很惊讶,我没有接受。 – 2013-05-01 06:25:45