我遇到了(应该是)简单的.htaccess重定向问题。我需要将任何具有“for_homes
”的网址更改为“for_home
”。.htaccess重定向问题
RewriteRule ^for_homes(.*)$ for_home$1 [L,R=301]
然而,当我去到任何网页与for_homes
我得到一个404
重写规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^for_homes(.*)$ for_home$1 [L,R=301]
RewriteRule ^for_business(.*)$ for_businesses$1 [L,R=301]
</IfModule>
是否'for_homes'总是出现在URL的开始?你的正则表达式意味着它('^ for_homes') –
你的代码中有'RewriteEngine on'吗?规则看起来不错! – Gerben