Subdomain to new domain redirection
I need simple code to do something like this.
For example开发者_运维百科 my old site page is www.old.com/homerun.html
, I want to redirect to a new page www.new.com/homerun/
, or www.old.com/themes/newpage.html
to www.new.com/themes/newpage/
.
So basically it will replace the domain and remove the .html
.
could this be done on htaccess?
Try something like the following (on the old host, root path)
RewriteEngine On
RewriteBase /
RewriteRule ^(.+?)(.html)$ http://www.new.com/$1/ [L,R]
精彩评论