Htaccess how do i ?

Discussion in 'PHP' started by MoneyMan, Jun 24, 2008.

  1. MoneyMan Not Active

    MoneyMan
    Joined:
    May 15, 2008
    Messages:
    87
    Likes Received:
    1
    How do i redirect 404 pages to the homepage using the .htaccess file ? i have recently renewed and renamed some URL's and id would rather people got my homepage than a 404 Error
  2. Iearn-Money Qdoos Contributor

    Iearn-Money
    Joined:
    Jun 10, 2008
    Messages:
    1,147
    Likes Received:
    8
    Location:
    Iearn-Money.Com
    Just go to your.htaccess file (or control panel) and type in the following:

    Change the name "404.php" to whatever the name for your custom error page is.

    You might be tempted to type in:

    But it won't work. Usually it will result in a 200 OK response. Once again, the path must be relative to root or it won't respond with a 404 error code properly.

    I think it will work with you!
  3. jasonk47 Not Active

    jasonk47
    Joined:
    Jun 21, 2008
    Messages:
    22
    Likes Received:
    3
    Location:
    California
    Wouldn't that redirect all of his 404 errors to the homepage if he were to use the homepage as his error page? A better solution would be to 301 redirect from the no longer active pages to the new pages:

    How to Redirect a Web Page Using a 301 Redirect
  4. sujal Not Active

    sujal
    Joined:
    Jul 17, 2008
    Messages:
    28
    Likes Received:
    0
    Htaccess can be used to password-protect directories on your web site. All files and any subdirectories within a directory protected by htaccess will also be protected.
  5. Dacian Not Active

    Dacian
    Joined:
    Jul 25, 2008
    Messages:
    6
    Likes Received:
    0
    The .htaccess file goes in the directory you want to protect.
    The passwordfile (allowlist) that you create by running the htpasswd
    command should go in your home directory.
Loading...

Share This Page