2014-10-10 77 views
1

重定向404頁,在Opencart的未發現:如何對我的.htaccess使用的.htaccess

我試圖將一個404頁about_us頁面重定向到關於美國頁使用行代碼下面

redirect 301 /about_us http://www.example.com/about-us 

但是當我試圖加載到瀏覽器有關,我們的頁面重定向到這個頁面

http://www.example.com/about-us?_route_=about_us,但仍然頁面是404錯誤

,這裏是我的.htaccess規則

RewriteBase/
#RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
#RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 
RewriteRule ^download/(.*) /index.php?route=error/not_found [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) 
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 
+0

你在.htaccess中有更多規則嗎?如果是的話,請在這裏發帖。 – anubhava 2014-10-10 16:05:42

+0

也許是因爲https版本的網站? – johnhgaspay 2014-10-10 20:06:02

回答

2

不要使用redirect規則與mod_rewrite規則。有這樣說:

RewriteEngine On 
RewriteBase/

RewriteRule ^about_us/?$ http://www.example.com/about-us [L,NC,R=301] 

#RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
#RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 
RewriteRule ^download/(.*) /index.php?route=error/not_found [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) 
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 

確保在新的瀏覽器進行測試,以避免舊的瀏覽器緩存

+0

感謝它完美的作品! – johnhgaspay 2014-10-10 21:10:12

+0

不客氣,很高興它解決了。 – anubhava 2014-10-10 21:18:02