-1

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.

Patrick Mevzek
  • 10,581
  • 7
  • 35
  • 45
anshu
  • 1

1 Answers1

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