Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2011
    Location
    Omaha, NE
    Posts
    49
    Thanks
    1
    Thanked 6 Times in 5 Posts

    .htaccess Redirect Url to similar but different URL

    I'm trying to redirect an entire website to another website, but still retain the extensions... for example:

    olddomain.com/contact ==> newdomain.com/contact
    olddomain.com/url1 ===> newdomain.com/url1
    olddomain.com/url2.php?var=125 ===> newdomain.com/url2.php?var=125

    and so on.

    I accidentally nuked a site while testing it, so I am hoping for some advisory, thank you.
    Web Design Omaha Ne
    Hold yourself responsible for a higher standard than anybody expects of you. Never excuse yourself.
    - Henry Ward Beecher

  • #2
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Divinityfound View Post
    I'm trying to redirect an entire website to another website, but still retain the extensions... for example:

    olddomain.com/contact ==> newdomain.com/contact
    olddomain.com/url1 ===> newdomain.com/url1
    olddomain.com/url2.php?var=125 ===> newdomain.com/url2.php?var=125

    and so on.

    I accidentally nuked a site while testing it, so I am hoping for some advisory, thank you.
    Use .htaccess file:
    Code:
    rewritecond %{http_host} ^olddomain.com [nc]
    rewriterule ^(.*)$ http://newdomain.com/$1 [r=301,nc]

  • #3
    New Coder
    Join Date
    Sep 2011
    Location
    Omaha, NE
    Posts
    49
    Thanks
    1
    Thanked 6 Times in 5 Posts
    Tried your bit of code... 404 error... Any other ideas?
    Web Design Omaha Ne
    Hold yourself responsible for a higher standard than anybody expects of you. Never excuse yourself.
    - Henry Ward Beecher


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •