php, mysql, mod_rewrite
Moderator: General Moderators
php, mysql, mod_rewrite
So lets say I would like to make a pretty url to have site.com/123 instead of site.com/index.php?i=123. I have the code to do this and it works. However, when you enter site.com/123 it goes to the page but the url in the address bar of the browser changes to site.com/index.php?i=123 instead of remaining at site.com/123. Does anyone know if it is possible to keep it as site.com/123 after the redirect?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php, mysql, mod_rewrite
Post "the code to do this" (rewrite rules?) and perhaps someone can help.
(#10850)
Re: php, mysql, mod_rewrite
Here is the .htaccess file:
Code: Select all
RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)/?$ http://site.com/getimage.php?i=$1 [L]
Re: php, mysql, mod_rewrite
By including the "http://site.com/" you're telling mod_rewrite to do an external redirect.
If you want everything to remain internal, get rid of it.
If you want everything to remain internal, get rid of it.
Re: php, mysql, mod_rewrite
Problem fixed. Thank you very much!