2015-08-15 120 views
0

嗨我有以下一個URL重寫工作,遺憾的是使用分頁時我的URL的SEO部分回來,而不是被迫進入301普遍的URL重寫?

RewriteRule ^catalog/html_sitemap/(.*)$ http://%{HTTP_HOST}/catalog/seo_sitemap/$1 [L,NC,P] 

我嘗試下面的代碼,但它是不成功的,我錯過了什麼?

RewriteBase/
RewriteCond %{REQUEST_URI} ^catalog/seo_sitemap/(.*)$ 
RewriteRule http://%{HTTP_HOST}/catalog/html_sitemap/$1 [QSA,R=301,L] 
+1

缺少清楚地說明這個問題,換一個。 – cnst

回答

1

您可以使用:

RewriteRule ^catalog/html_sitemap/(.*)$ http://%{HTTP_HOST}/catalog/seo_sitemap/$1 [L,NC,R=301] 
+0

由於'catalog/html_sitemap /'實際上並不存在,只有'catalog/seo_sitemap /'確實存在,所以我最終進入了404頁面。雖然非常接近! – ehime

+0

是的,但在這種情況下,你爲什麼反轉我的答案?因爲我這樣做。 – Croises

+0

我說錯了,你是對的。恢復我的更正 – ehime