Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2002
    Location
    Florida, USA
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    404 redirect to homepage .htaccess

    I am currently using this 404 redirect back to my homepage in my .htaccess under Linux/Apache

    ErrorDocument 404 http://www.cyberserious.com

    This works great, but I want to find out how I can set it up to retain any bad page URLs in the browser's address bar instead of removing them from my homepage URL, and works for all types of pages - php and html.

    IE: If somebody attempts to go to a non-existent page like
    http://www.cyberserious.com/xyz.html

    I would like the redirect to retain the "/xyz.html" part when it redirects to

    http://www.cyberserious.com

    and continue to appear as http://www.cyberserious.com/xyz.html

    in their browser's address bar, instead of bouncing to http://www.cyberserious.com

    Reason: I want to protect my privacy from prying eyes who want to find out if I'm using php, asp, etc..
    Fred

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    How would keeping a person on the bad page verses redirecting them to the homepage prevent them from finding out what kind of server side language you are using? If you want to disguise what language you are using there are easier ways of going about it. The most obvious way is to change the file extensions of all your PHP or ASP, etc pages to .htm or whatever and set up apache to handle all of those as PHP or ASP pages.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Nov 2002
    Location
    Florida, USA
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I could do that, but the disadvantage there, is parsing all the html pages through the php engine puts a load on the server and slows down the entire site.

    This is not a serious issue, but I did want to see if I can do it, since I saw other sites doing it.
    Fred

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Fred
    Yes, I could do that, but the disadvantage there, is parsing all the html pages through the php engine puts a load on the server and slows down the entire site.

    This is not a serious issue, but I did want to see if I can do it, since I saw other sites doing it.
    Fred
    Yes all pages would be parsed by the PHP engine but the difference wouldn't be very noticable.

    If you don't like that idea then create your own extension for just the server side pages and just have apache send those pages to the PHP engine. If you have files like index.fred then they won't know what language you are using.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •