WordPress.org

Ready to get started?Download WordPress

Forums

Fixing redirects in htaccess after domain change (1 post)

  1. websupportguy
    Member
    Posted 2 years ago #

    I have recently changed the domain URL on a website and taken away a root level folder, and I am having problems getting the redirects to work correctly.

    The domain to domain redirection works fine – ie, http://bangkoktravelthailand.com redirects with 301 to http://traveltipsthailand.com. But links to deep URLs in the old domain still load the page with the old domain URL, eg try http://bangkoktravelthailand.com/thailand/bangkok/yaowarat/

    If all transforms were working correctly it would redirect to: http://traveltipsthailand.com/bangkok/yaowarat/ (as the "/thailand/" folder is no longer used on the site.

    There are two htaccess rules in place which should be transforming this url:

    RewriteCond %{HTTP_HOST} ^bangkoktravelthailand\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.bangkoktravelthailand\.com$
    RewriteRule ^/?$ "http\:\/\/traveltipsthailand\.com" [R=301,L]

    and

    RewriteRule ^thailand/(.*)$ http://traveltipsthailand.com/$1 [R=301,L]

    The second rewrite rule does work to remove "/thailand/" from URL strings if the domain in the URL is "traveltipsthailand.com", but not if it's "bangkoktravelthailand.com". Does that make sense?

    I also tried a variation of the first rewrite rule as:
    RewriteRule ^(.*)$ http://traveltipsthailand.com/$1 [R=301,L]
    but that didn't work either.

    Can anyone suggest a rule that will work for me? I've run out of ideas and google searches to try.

    Tony

Topic Closed

This topic has been closed to new replies.

About this Topic