Why does this work? The only thing I can figure is that the query
string is simply added to the end (as is says in the docs) of the new
page. But I'm not even referencing the query string in the first
part. Do I not need to do that? Does QSA take whatever the query
string is and append it automatically to the new page?
Thanks,
Mark
-------------------------------
On Mar 1, 2006, at 12:19 PM, Brian V. Hughes wrote:
Mark Wheeler wrote:
-------------------------------------------------
Options +FollowSymlinks
RewriteEngine on
# Set the RewriteBase to "/" for the root level to base everything
on... I guess.
RewriteBase /
RewriteRule ^oldpage.php(.+) newpage.php$1&otherid=0 [R]
-------------------------------------------------
The $1 should have all the variable stuff in it from the php.
So I'm looking for it to essentially do this:
oldpage.php?id=1 redirects to newpage.php?id=1&otherid=0
Why is this not working? Any help would be appreciated.
Because the RewriteRule directive doesn't parse anything beyond the
path portion of the requested URL. If you want to capture the query
string, you have to use a RewriteCond statement to store the query
string in a regex back-reference. You can then make use of the
RewriteCond's back-references in a succeeding RewriteRule statement.
There's actually a shortcut for doing this (check the QSA flag in the
mod_rewrite docs), but you need to modify the query string in the
rewritten URL, so you can't use that.
-Brian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden