开发者

Subdomain to new domain redirection

开发者 https://www.devze.com 2023-02-22 09:58 出处:网络
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/new

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]
0

精彩评论

暂无评论...
验证码 换一张
取 消