Forum Moderators: phranque
Like others here I've learned a lot from these forums and have managed to muddle through until now. I've recently come up against a problem I just can't see a solution to and desperately need help!
I'm doing some fairly basic url rewriting:
RewriteEngine on
#CLUB REWRITE
RewriteRule ^club/([^/]+)$ /virtual/club/index.php?clubName=$1 [QSA,L]
RewriteRule ^club/(.*)/(.*)$ /virtual/club/$2?clubName=$1 [QSA,L]
The first rule handles url requests of:
http://www.example.com/club/myclub
and
http://www.example.com/club/myclub/
The second rule handles url requests of:
http://www.example.com/club/myclub/somepage.php
This all works. My problem is I want to use URLs like:
http://www.example.com/club/myclub/somepage.php?myvar=1
so that this page is served:
http://www.example.com/virtual/club/somepage.php?myvar=1&clubName=myclub
I recently came across the QSA flag and thought I'd cracked it but it still just not seem to pass the requested query string, only the "clubName". What am I doing wrong? Are there any cases (versions, settings etc.) in which QSA does not work? And, finally, is there a better way to achieve this goal?
Any help would be very much appreciated!
Stephen.
You might want to check with your host to make sure the Apache installation isn't corrupt -- or isn't a really old version... Can't think of any reason why your code wouldn't work.
If you're stuck with that host, you could try a "manual" work-around -- essentially duplicating the [QSA] function:
RewriteCond %{QUERY_STRING}& ^((.+&)¦&)$
RewriteRule ^club/([^/]+)/([^/]+)$ /virtual/club/$2?%2clubName=$1 [L]
Jim
My host is running Apache version 1.3.39 (Unix), I'm not sure if that is considered old?
I'll contact support about this QSA issue and if they discover anything useful I'll update this thread for anyone else that might need it. In the meantime your suggested workaround is exactly what I need so I'll give it a go.
Thanks again,
Stephen