|
-
Oct 10th, 2008, 06:29 PM
#1
Thread Starter
Addicted Member
htaccess and php
i have this gallery which has links like this.
gallery.php?user=205
205 here is a userid.
i am using mod_rewrite to have another script decide the userid from this url.
mysite.com/gallery/someuser
here "someuser" is username. the script in mod_rewrite is deciding the userid from the username. it's in the database.
i am using the header() function in the script to get the the gallery.php?user=$id
now the URL on the browser changes to gallery.php?user=205
for an example username "someuser" has a userid of 205.
so when someone visits http://mysite.com/gallery/someuser, mod_rewrite sends it to redirect.php?username=someuser
then redirect.php finds out the userid from the database and redirects to gallery.php?user=205.
as the redirect.php is using the header() function to redirect, the browser url changes to gallery.php?user=205.
is there a way to get around this and the URL in the browser stays the same?
gallery.php isnt a script of my own and i don't feel like editing it.
-
Oct 11th, 2008, 09:27 AM
#2
Re: htaccess and php
If you send a redirect header then the URL in the address bar will change. There is nothing you can do about that. If you want to ensure that this doesn't happen, set the appropriate $_GET variable and then include the gallery.php script.
-
Oct 11th, 2008, 01:06 PM
#3
Thread Starter
Addicted Member
Re: htaccess and php
is there no way to send some variable to an htaccess file?
-
Oct 12th, 2008, 03:52 AM
#4
Re: htaccess and php
You can set an environment variable and provided the server config allows you to read an environment variable from the htaccess file and provided Apache is running as a module. Again however, you don't need to do this, it is counter productive and pointless.
In an htaccess file you can access an environment variable using the following syntax: %{ENV:VarName}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|