WordPress.org

Ready to get started?Download WordPress

Forums

Redirect Domain using HTACCESS (5 posts)

  1. Sandman
    Member
    Posted 9 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
    Member
    Posted 9 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
    Member
    Posted 9 years ago #

  4. Nick Momrik
    Member
    Posted 9 years ago #

    Example...

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

  5. belloq
    Member
    Posted 8 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.

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

    /Dennis

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.