2012-07-03 4 views
0

아래 규칙은 완벽하게 작동하지만 이전 사이트 URL은 .html이고 newsite는 그렇지 않습니다. 리디렉션 전에 .html을 제거 할 수 있습니까? 예 :Htaccess로 리디렉션하기 전에 .html을 제거하십시오.

www.oldsite.com/mypage.html

www.newsite.com/subdir/mypage/

예를 들어, 리디렉션됩니다

Options +FollowSymLinks 
RewriteEngine on 

RewriteCond %{HTTP_HOST} ^www.oldsite.com$ [NC] 
RewriteRule ^(.*)$ http://www.newsite.co.uk/subdir/$1 [R=301,L] 

답변

1
Options +FollowSymLinks 
RewriteEngine on 

RewriteCond %{HTTP_HOST} ^www.oldsite.com$ [NC] 
RewriteRule ^(.*)\.html$ http://www.newsite.co.uk/subdir/$1 [R=301,L] 

그래서 www.oldsite.com/mypage.htmlwww.newsite.com/subdir/mypage

로 리디렉션됩니다
관련 문제