.htaccess不接受重写规则



我买的系统的htaccess文件有问题。

原始文件看起来像这样:

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

修改后的版本如下:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^city-([^/]+).html searcharea?city=$1&sd=ls [L]
RewriteRule ^city-normal-([^/]+).html searcharea?city=$1&sd=pb [L]
RewriteRule ^city-special-([^/]+).html searcharea?city=$1&sd=oeb [L]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule> 

system Base Home Link是这样的:

http://www.url.de/store/home

和我的。htaccess完全被忽略了,我想知道为什么?我想包括一个seo链接到系统和引用其url的功能,但它不与此htaccess工作。

我有这个htaccess规则在我的其他htaccess文件从另一个系统,那里它工作得很好。

编辑:

的规则从原始文件工作,只是我的规则被忽略。启用Mod_rewrite

目录结构:

/
/.htaccess
/index.php -> uses yiiframework to build pages
/core
/core/css
/core/js

这是因为您的原始htaccess规则与新规则相冲突,它们将所有不存在的请求重写为index.php。要解决这个问题,你需要重新排序你的规则。

试题:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^city-([^/]+).html searcharea?city=$1&sd=ls [L]
RewriteRule ^city-normal-([^/]+).html searcharea?city=$1&sd=pb [L]
RewriteRule ^city-special-([^/]+).html searcharea?city=$1&sd=oeb [L]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

</IfModule> 

确保您的服务器上的apache中启用了mod_rewrite。

最新更新