Help - Search - Members - Calendar
Full Version: URL rewriting
Hostony Board > General Support > PHP/MySQL
motts68
Hi. My site uses one ?id= get query for almost all the php pages. Is there a way to rewite the URLs so that
http://www.opacity.us/image.php?id=455
becomes
http://www.opacity.us/image/455

Not sure if this is possible.
Thanks
JasonJones
Sure its possible, easily as well... Everything is possible smile.gif

So ok.. lets write the code up...

CODE
RewriteEngine on
RewriteBase /  
RewriteRule ^/image/([0-9]+)$ /image.php?id=$1  [L]


That will let people use http://www.opacity.us/image/455 as their url and it will rewrite to http://www.opacity.us/image.php?id=455

I hope that helped.

Jason
motts68
Great thanks!

For others wondering, this code goes in the .htaccess file of your website... it took me a minute to figure that out 8]

Poking around more, the "fake file name" method works better for me :

RewriteRule image(.*)\.htm$ /image.php?id=$1

So the url looks like http://www.opacity.us/image455.htm

Now I just gotta change all the links to point to htm files rather than php.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here