Where Can I Find My .htaccess file and Redirect Using 301 for my HTML Site?

Discussion in 'HTML & Website Design' started by rbf738, Sep 1, 2009.

  1. #1
    I'm working within the same domain, so I want to redirect an existing subdomain to a new domain within the same site. I've never done a 301 redirect and tried searching about it here at DP and abroad on the net but can't seem to find all of the information I need.

    Can someone clearly layout how I can find my .htaccess file, what I need to do with it, and how to reupload it? Thanks.
     
    rbf738, Sep 1, 2009 IP
  2. aimtowin

    aimtowin Active Member

    Messages:
    143
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    You can create your own in a text file but you will have to rename it from htaccess.txt to .htaccess before you upload it to the site root. (Or you can just rename it via FTP when you have uploaded the htaccess.txt file.)

    1. To create a .htaccess file, open notepad, name and save
    the file as .htaccess (there is no extension).

    2. If you already have a .htaccess file on your server,
    download it to your desktop for editing.

    3. Place this code in your .htaccess file:

    redirect 301 /old/old.htm http://www.you.com/new.htm

    4. If the .htaccess file already has lines of code in it,
    skip a line, then add the above code.

    5. Save the .htaccess file

    6. Upload this file to the root folder of your server.

    7. Test it by typing in the old address to the page you've
    changed. You should be immediately taken to the new
    location.
     
    aimtowin, Sep 1, 2009 IP
  3. rbf738

    rbf738 Peon

    Messages:
    475
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I didn't see a .htaccess file anywhere on my server when I checked so I guess i can assume i don't have one. Would it only exist if I had created one in the past?

    Also, when you say step 3: redirect 301 /old/old.htm http://www.you.com/new.htm

    you mean omit the "http://www.example" bit and just move onto the subdomains so "/oldsubdomain1/oldsubdomain2.htm, then for the new half put in "http://www.example/newsubdomain.htm right next to it?

    I'm a bit unclear on this vital part.
     
    rbf738, Sep 1, 2009 IP
  4. rbf738

    rbf738 Peon

    Messages:
    475
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm doing something wrong because after uploading the text file it still takes me to the same url, no redirect is happening.
     
    rbf738, Sep 1, 2009 IP
  5. rbf738

    rbf738 Peon

    Messages:
    475
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I think bumping is illegal, but I really don't know what I'm doing wrong. I've consulted something like 10 sites and as far as I know I'm doing it correctly in theory but it's not redirecting when I enter the original URL.
     
    rbf738, Sep 2, 2009 IP
  6. extraspecial

    extraspecial Member

    Messages:
    788
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    45
    #6
    I did that a long time ago and I remember that I had taken help from my web host, why don't you ask them about your redirecting problem...
     
    extraspecial, Sep 2, 2009 IP