0

Due to a previously misconfigured rewrite rule I have a whole lot of errors listed in webmaster tools like the following:-

http://www.domain.com/www.domain.com/page.html
http://www.domain.com/www.domain.com/page-two.html
http://www.domain.com/www.domain.com/another-page.html

This looked promising https://stackoverflow.com/questions/5976814/removing-string-from-url-using-htaccess but could not get it to work with the following:-

RewriteRule ^/www.domain.com/(.*)$ /$1 [R=301,L,QSA]

or

RewriteRule ^/www\.domain\.com/(.*)$ /$1 [R=301,L,QSA]

1 Answer 1

0

You have to put . (full stops) in square brackets like that [.] then it should work.

EDIT:

This should work: RewriteRule ^/www[.]domain[.]com/(.*)$ /$1 [R=301,L,QSA]

Full stops are now not treated as special characters.

1
  • Great, got it working with: RewriteRule ^www[.]domain[.]com/(.*)$ /$1 [R=301,L,QSA] (no leading slash) Feb 27, 2013 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.