Web Hosting Talk







View Full Version : mod_rewrite


CreativeLogic
04-21-2004, 12:11 AM
I cannot get the rewrite rule correct...

This is what I want:

I want both of the following:

http://www.site.com/folder/file.php?foo=bar
http://folder.site.com/file.php?foo=bar

To change to:

http://www.site.com/file.php?foo=bar&var=folder

Everything I try I just cannot get the original variables to pass...

siplnettech
04-21-2004, 01:42 AM
You can do this using the ForceType method or mod_rewrite. mod_rewrite is a little more complex, but more powerful. Visit this link:
http://httpd.apache.org/docs/mod/mod_rewrite.html
hope it will help :)

Loon
04-21-2004, 05:25 AM
RewriteRule ^(.*)/file.php?foo=(.*) file.php?foo=$2&var=$1

should work for the first, unless there's a subdomain created for the second, i don't think you'll be able to do that.

CreativeLogic
04-21-2004, 07:09 AM
I need the actual variable names and the variable's value to be passed along. Oh and file.php maynot always be file.php. Those are the main reasons I'm having such big problems iwth it.