|
Home > Archive > Apache Server configuration support > October 2007 > Mod Rewrite - Variables after conditions
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Mod Rewrite - Variables after conditions
|
|
| adam@areasix.co.uk 2007-10-16, 7:24 pm |
| I have a few conditions written in my .htaccess which all work fine,
but my problem is I want to use variables after the rewritten
conditions. I have conditions written similar to the following, but
how can I get it to take into account anything after the condition?
..htaccess ----
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(cp|forum|etc)/?$ index.php?module=$1 [L]
This rewrites http://mysite.com/cp/ to http://mysite.com/index.php?module=cp
but for AJAX purposes I would like to rewrite the following:
http://mysite.com/cp/?ajax=true --> http://mysite.com/index.php?module=cp&ajax=true
I have a few more purposes for this so it would be useful to set a
general rule.
Thanks in advance
| |
| Jim Hayter 2007-10-16, 7:24 pm |
| adam@areasix.co.uk wrote:
> I have a few conditions written in my .htaccess which all work fine,
> but my problem is I want to use variables after the rewritten
> conditions. I have conditions written similar to the following, but
> how can I get it to take into account anything after the condition?
>
>
> ..htaccess ----
>
> Options +FollowSymlinks
> RewriteEngine On
>
> RewriteRule ^(cp|forum|etc)/?$ index.php?module=$1 [L]
>
>
> This rewrites http://mysite.com/cp/ to http://mysite.com/index.php?module=cp
> but for AJAX purposes I would like to rewrite the following:
>
> http://mysite.com/cp/?ajax=true --> http://mysite.com/index.php?module=cp&ajax=true
>
> I have a few more purposes for this so it would be useful to set a
> general rule.
>
> Thanks in advance
>
To keep the original query string, you just to add the "QSA" flag to
your rule (e.g., [L] becomes [QSA,L]).
Jim
|
|
|
|
|