Htaccess help

Discussion in 'Programming' started by RJP1, Apr 11, 2010.

  1. #1
    RJP1, Apr 11, 2010 IP
  2. opticalpigion

    opticalpigion Well-Known Member

    Messages:
    220
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    168
    #2
    
    ErrorDocument 404 http://www.mysite.com/404.php
    
    Code (markup):
    
    redirect 301 /old/old.htm http://www.you.com/new.htm 
    
    Code (markup):
     
    opticalpigion, Apr 12, 2010 IP
  3. nimonogi

    nimonogi Active Member

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    80
    #3
    A 301 redirect is the most efficient and spider/visitor friendly strategy around for web sites that are hosted on servers running Apache.
    The following code should be placed in the .htaccess file of your root directory:

    
    redirect 301 /old/old.htm http://www.you.com/new.htm
    
    #  redirect 301 (the instruction that the page has moved)
    #  /old/old.htm (the original folder path and file name)
    #  http://www.you.com/new.htm  (new path and file name)
    
    Code (markup):
    Good luck.
     
    nimonogi, Apr 13, 2010 IP
  4. RJP1

    RJP1 Active Member

    Messages:
    345
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #4
    Yes, but these aren't dynamic...
     
    RJP1, Apr 13, 2010 IP
  5. nimonogi

    nimonogi Active Member

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    80
    #5
    You can't create a dynamic 301 redirect.
    If you want a RewriteRule, try the following code:
    
    RewriteEngine On
    RewriteRule ^folder/anotherfolder/([^/]*)$ /folder/anotherfolder/name/asc/$1  [L]
    
    Code (markup):
     
    nimonogi, Apr 13, 2010 IP
  6. Brandon Sheley

    Brandon Sheley Illustrious Member

    Messages:
    9,721
    Likes Received:
    612
    Best Answers:
    2
    Trophy Points:
    420
    #6
    Brandon Sheley, Apr 13, 2010 IP