开发者

redirect ex-ample.com/asdf to example.com/asdf

开发者 https://www.devze.com 2023-01-19 13:28 出处:网络
I want to redirect all requests from ex-ample.com to example.com. The url structure should remain the same, I only want to \"replac开发者_开发百科e\" the \"-\" in domain...

I want to redirect all requests from ex-ample.com to example.com. The url structure should remain the same, I only want to "replac开发者_开发百科e" the "-" in domain...

http://www.ex-ample.com/asdf123
redirects to:
http://www.example.com/asdf123

thanks!


If it’s just a single hyphen:

RewriteCond %{HTTP_HOST} ^([^-]+)-([^-]+)$
RewriteRule ^ http://%1%2%{REQUEST_URI} [L,R]
0

精彩评论

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