Help
-
Search
-
Members
-
Calendar
Full Version:
URL rewriting
Hostony Board
>
General Support
>
PHP/MySQL
motts68
Oct 28 2004, 05:57 PM
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
Oct 28 2004, 06:30 PM
Sure its possible, easily as well... Everything is possible
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
Oct 28 2004, 08:52 PM
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.