Php redirect help

I have a site which hv urls like

i want, when a user add ’ at the end of url i.e

the user get redirected to err0r.php
page in my site…

Why do you want purposely send your visitors to an error page?

You want to first check that the id coming in is a valid id for example with:
[php]if(preg_match("/^[1-9][0-9]{0,15}$/", $id)) { do_something_when_valid(); }; [/php]

If the id is not valid you can use
[php]header(‘Location:’); [/php] The url has to be absolute.

You could also just use
[php]include(“php-with-error-info.php”) [/php] to include your error message.

[php]echo “That id is not valid, bro!”;[/php] might do too. Having to use header redirects is usually sign of something being wrong.

Sponsor our Newsletter | Privacy Policy | Terms of Service