我遇到了(應該是)簡單的.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