My url is http://www.abctest.com/mysamples/ . I need to replace this with http://www.abctest.net/mysamples/ . Please let me know how to write a regular expression to match the repeated pattern (www.abctest.com/mysamples) and replace it with http://www.abctest.net/mysamples using RewriteRule.
Asked
Active
Viewed 126 times
1 Answers
0
Did you look at Apache documentation? It has your exact use case here: http://httpd.apache.org/docs/2.4/rewrite/remapping.html#canonicalhost
RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
RewriteCond "%{HTTP_HOST}" "!^$"
RewriteRule "^/?(.*)" "http://www.example.com/$1" [L,R,NE]
Patrick Mevzek
- 10,581
- 7
- 35
- 45