1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess Help...Can't Figure This Out

Discussion in 'Web Design' started by crazyflx, Jun 9, 2010.

  1. crazyflx

    crazyflx Elite Member

    Joined:
    Nov 9, 2009
    Messages:
    1,676
    Likes Received:
    4,834
    Alright, I tried searching google, and while I found a lot of answers that were ALMOST what I needed, nothing quite does EXACTLY what I need. Hopefully somebody here can help me out.

    I have a site that I just copied completely to a brand new domain...but in a sub-directory.

    I need a .htaccess code that can do this:

    Take http://oldsite.com/page1.htm and turn it into:

    http://newsite.com/newdirectory/page1.htm

    It has to be able to do that for ALL the pages of http://oldsite.com/ automatically.

    Any suggestions?
     
  2. crazyflx

    crazyflx Elite Member

    Joined:
    Nov 9, 2009
    Messages:
    1,676
    Likes Received:
    4,834
    Alright, I got it figured out, I was over-complicating things.

    Code:
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^olddomain.com [NC] 
    RewriteRule ^(.*)$ http://newdomain.com/newdirectory/$1 [L,R=301]