2011-08-22 129 views
0

我有我的網站的以下網址結構:htaccess的301重定向問題

http://domain.com/slug/1/test-test.html 
http://domain.com/slug/2/test-test.html 

,我想將其更改爲

http://domain.com/new-1-test-test.html 
http://domain.com/new-2-test-test.html 

我已經嘗試

RewriteRule ^slug$ /new- [R=301,L] 
RewriteRule ^/?my\slug /new [R=301,L] 

但它沒有工作.. 任何人都知道如何重定向這與htaccess?

感謝

回答

0
RewriteEngine On 
RewriteRule ^slug/([0-9])/(.*)$ /new-$1-$2 [R-301,L] 
1

試試這個 - RewriteRule ^slug/([0-9]+)/(.*)$ /new-$1-$2 [R=301, L]