2015-03-02 63 views
0

我最近通過htaccess從查詢字符串將虛擬文件夾寫入我的網站,並且它工作得很好。 因爲SEO問題,我需要重定向舊網頁到新的虛擬文件夾addresses.I時遇到的重定向模式的麻煩,我desperated :(RedirectMatch 301將查詢字符串更改爲文件夾

我需要重定向URL像?頁= artreader & ID = 56FA/56

我使用此代碼htaccess的,但它不是工作的罰款。

RedirectMatch 301 ^(.+)page=artreader&id=(.+)$ http://www.mywebsite.com/fa/$2 

我很感激,如果有人能幫助我

回答

0

您可以在DOCUMENT_ROOT/.htaccess文件中使用此代碼:

RewriteEngine On 
RewriteBase/

# external redirect from actual URL to pretty one 
RewriteCond %{THE_REQUEST} \?page=artreader&id=([^\s&]+) [NC] 
RewriteRule^fa/%1? [R=302,L,NE] 

# internal forward from pretty URL to actual one 
RewriteRule ^fa/([^/.]+)/?$ ?page=artreader&id=$1 [L,QSA,NC]