Log in

View Full Version : Looking for url_rewriter documentation



Dennis_Gull
06-27-2007, 08:19 AM
Hello, Im currently building a homepage where I want to rewrite the url from exapme.php?id=balbal to example_name.html but I cant find any documentation or tutorials on how to rewrite the url with php, all I get is loads of crap on how to rank better and so on.
So anyways, could someone point me to the right direction? :)

djr33
06-27-2007, 08:42 AM
<?php
header('Location: http://my.com/example_' . $_GET['id'] . '.html');
?>

This will redirect to the page example_[id=].html

There is no error checking in place, so you might want to consider that, too.

tech_support
06-27-2007, 08:44 AM
Also, change the file extension (.html) to .php if you need it.
And you don't need the my.com if you are redirecting to a page on your website.

djr33
06-27-2007, 08:53 AM
It's better to use a full url when sending out a location header, though it works in most/many cases with a relative path.

Dennis_Gull
06-27-2007, 10:04 AM
Thanks for the reply, But how will I then get the "fake" url to work as it should. I mean example_<id>.html doesnt really exist :)

alexjewell
06-27-2007, 02:39 PM
Ahh, use url rewriting to do that.

http://www.webmasterworld.com/forum88/4303.htm

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

http://www.sitepoint.com/article/guide-url-rewriting

Dennis_Gull
06-27-2007, 06:09 PM
Thanks I will check the links.