...

View Full Version : Mod Rewriting A ?x=



Sussex_Chris
01-20-2011, 06:08 PM
I have the following mod rewrite process which works
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.([^/]*) http://127.0.0.1/test/test.php?i=$1&p=$2&t=$3 [L]

Example URL: 127.0.0.1/test/1/999.jpg. Redirects To: 127.0.0.1/test/test.php?i=1&p=999&t=jpg

I would also like to add in a variable after the image type but in an actual variable format such as:
http://127.0.0.1/myzon/1/999.jpg?r=1

Does anybody know how I could ammend my rewrite function to allow this & then redirect to test.php?i=$1&p=$2&t=$3&r=$4?

Fou-Lu
01-20-2011, 08:27 PM
You probably don't need too. Add QSA as a flag to the end of your pattern and it should append a querystring onto it for you (ie: [QSA,L]). Unfortunately (I don't do a lot of rewriting myself) I'm not sure if its smart enough to ignore the ?, and just continue (I'm not certain if the result will be: http://127.0.0.1/test/test.php?i=$1&p=$2&t=$3&r=1 or if it will be http://127.0.0.1/test/test.php?i=$1&p=$2?t=$3, but my suspicion is it will be the former which is good).
See if that works for you.

Sussex_Chris
01-20-2011, 08:35 PM
You probably don't need too. Add QSA as a flag to the end of your pattern and it should append a querystring onto it for you (ie: [QSA,L]). Unfortunately (I don't do a lot of rewriting myself) I'm not sure if its smart enough to ignore the ?, and just continue (I'm not certain if the result will be: http://127.0.0.1/test/test.php?i=$1&p=$2&t=$3&r=1 or if it will be http://127.0.0.1/test/test.php?i=$1&p=$2?t=$3, but my suspicion is it will be the former which is good).
See if that works for you.
I always forget simple things like that, sorted now, thanks a lot :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum