301 Redirecting A DIR To A .html File

Discussion in 'Search Engine Optimization' started by KJW, Dec 11, 2007.

  1. #1
    I'm attempting to 301 a directory on an old domain to a .html file on a new domain...

    I tried this in my .htaccess file, and it did not work:

    redirect 301 /olddir/ http://www.newdomain.com/newfile.html

    Any suggestions?
     
    KJW, Dec 11, 2007 IP
  2. Jean-Luc

    Jean-Luc Peon

    Messages:
    601
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What error did you get ?

    What you wrote should redirect http://www.olddomain.com/olddir/ to http://www.newdomain.com/newfile.html. Note that it should not redirect http://www.olddomain.com/olddir (without the trailing slash).

    Jean-Luc
     
    Jean-Luc, Dec 11, 2007 IP
  3. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #3
    RewriteRule ^/dir/?$ [url]http://newdomain/file.html[/url] [R=301,L]
    Code (markup):
     
    Synchronium, Dec 11, 2007 IP
  4. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the responses, but no luck...

    When I do the redirect the server directs the dir, but it ends up at the new domain with /olddir/ at the end...

    Any thoughts?
     
    KJW, Dec 11, 2007 IP
  5. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #5
    You could just create a index file in that directory that re-directs to that page, you can use the below php code to do this, just create index.php, insert the code and upload.

    
    <?php
    header("location: http://www.fileurl.goes.here.com");
    ?>
    
    Code (markup):
    This is great to use if your having .htaccess problems or can't access it.
     
    astup1didiot, Dec 11, 2007 IP
  6. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, I'm attempting to redirect a lot of different DIRs to new .html files... So that index idea won't work. Thanks anyway! :D

    Anyone else?
     
    KJW, Dec 12, 2007 IP
  7. Jean-Luc

    Jean-Luc Peon

    Messages:
    601
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Did you ask to your hosting company ? What do they say ?

    Jean-Luc
     
    Jean-Luc, Dec 12, 2007 IP
  8. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Jean-Luc,

    I have an email in with them... I'll let you know what they say!
     
    KJW, Dec 12, 2007 IP
  9. oseymour

    oseymour Well-Known Member

    Messages:
    3,960
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    135
    #9
    .htaccess is your best bet....I don't know of any host to date that does 301........godaddy says they have a 301 service but any external test I use sees a 302 anyway...
     
    oseymour, Dec 12, 2007 IP
  10. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Yeah my host had nothing for me... I'm not sure why the 301 I have attempted is not working.. I'll keep at it..

    In the mean time, anyone else have any TIPS? :D
     
    KJW, Dec 13, 2007 IP
  11. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #11
    I don't see how the PHP redirect wouldn't work, you can add a index.php file with the above code in EVERY directory you want to forward to a file.
     
    astup1didiot, Dec 13, 2007 IP
  12. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    ssandecki,

    I have not done any research on the PHP forward you are discussing. Is it a "Google friendly" / "SEO friendly" method?

    Thanks for the suggestions everyone!
     
    KJW, Dec 14, 2007 IP
  13. KJW

    KJW Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    *** bump ***​
     
    KJW, Dec 18, 2007 IP