Redirect Domain using HTACCESS (5 posts)

  1. Sandman
    Posted 11 years ago #

    I have changed domains recently, and still have a lot of visitors to the old domain. Here is my question:

    Using .htaccess, how can I get this to happen?

    -> User goes to http://www.olddomain.com
    -> .htaccess file auto directs to http://www.newdomain.com
    -> The End

    I already know about meta refresh, but I'd rather use .htaccess if possible.

    Thanks in advance.

  2. Nick Momrik
    Posted 11 years ago #

    I use this to redirect all requests at my site that contain www to the URL without www.

    RewriteCond %{HTTP_HOST} !^mtdewvirus.com$ [NC]
    RewriteRule ^(.*)$ http://mtdewvirus.com/$1 [R=301,L]

    I bet if you put this at your old domain and simply change the 2nd line to your new use your new domain, it would work.

  3. orangeguru
    Posted 11 years ago #

  4. Nick Momrik
    Posted 11 years ago #


    RewriteCond %{HTTP_HOST} !^olddomain.com$ [NC]
    RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

  5. belloq
    Posted 11 years ago #

    Does anyone know if the code above will help me as well? I'm about to change domain and it would be nice if someone who comes to a single post or page on the old domain gets redirected to the same post or page on the new domain.

    Old link: olddomain.com/2005/07/25/yada-yada-yada
    redirect to: newdomain.com/2005/07/25/yada-yada-yada


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.