lackeroom
06-12-2004, 09:40 AM
Helllo,
I want to redirect the request URL coming from http://www.mydomain.com/files/index.php?file=dir/dir/dir to http://www.mydomain.com/files/dir/dir/dir
How could this be done ?
Thanks!
Burhan
06-12-2004, 10:47 AM
It think what you want is
/files/dir/dir/dir --> mod_rewrite --> index.php?file=/dir/dir/dir
Try the following (untested)
RewriteEngine on
RewriteBase /files/
RewriteRule ^(.*?)$ index.php?file=$1 [R]
lackeroom
06-12-2004, 12:49 PM
no fyrestrtr .. I need the opposite coz I need DAP to resume and it wont resume on index.php ...
Burhan
06-13-2004, 02:24 AM
Oh. Then try this
RewriteEngine on
RewriteBase /files/
RewriteRule ^index.php?file=(*.?)$ http://host.sld.tld/files/$1 [R]
Again, untested.
lackeroom
06-13-2004, 07:05 AM
it didn't work :S
got internal server error..
Burhan
06-13-2004, 08:18 AM
Do you have http://host.sld.tld/files/dir/dir/dir/?
gogocode
06-13-2004, 08:22 AM
Originally posted by fyrestrtr
Oh. Then try this
RewriteEngine on
RewriteBase /files/
RewriteRule ^index.php?file=(*.?)$ http://host.sld.tld/files/$1 [R]
Again, untested.
I don't think mod_rewrite will rewrite query strings??
In any case remember that rewrite rule is a regexp, so ^index.php?file=(*.?)$ is invalid, you want ^index\.php\?file=(.*)$
lackeroom
06-13-2004, 10:33 AM
yes I do have it fyrestrtr
gogocode : I tried your way but it didnt change the URL
GameDose
06-14-2004, 08:08 PM
you don't want mod_rewrite, I think you want the user to be redirected completely.
You would just use the header() method in php:
header("location:newurl");
was for parsing the url...I can't think fast enough to figure it out.