Requested url with 404 error page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaYak
Forum Commoner
Posts: 65
Joined: Mon Feb 02, 2004 2:43 pm
Location: USA

Requested url with 404 error page

Post by kaYak »

I want to do a 404 error page where if someone types in a bad url it will keep that url in the address bar instead of it saying the 404 error page's url. Does someone know how to do this? For example Google does this. Try typing in a weird url for Google like google.com/fdjdf or something and you will see what I mean. :)
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

[google]mod_rewrite[/google]

You can use it to send all requests to one page, then that page will see where to go based on what the request was, without changing the URL for the client.
kaYak
Forum Commoner
Posts: 65
Joined: Mon Feb 02, 2004 2:43 pm
Location: USA

Post by kaYak »

Could someone please give me the exact code because I have no clue which thing to use?
User avatar
uberpolak
Forum Contributor
Posts: 261
Joined: Thu Jan 02, 2003 10:37 am
Location: Next to the bar

Post by uberpolak »

There isn't really an "exact code" solution, it depends on your server. You have to do some reading and get a feel for using mod_rewrite.

Unfortunately, there's no dont_change_url_but_display_404(); function. This one's a little more complex.
kaYak
Forum Commoner
Posts: 65
Joined: Mon Feb 02, 2004 2:43 pm
Location: USA

Post by kaYak »

Okay, thanks for your help
Post Reply