Forum Moderators: phranque

Message Too Old, No Replies

Strange .htaccess logics?

Is the .htaccess strange or am i stupid?

         

Dalpe

10:01 pm on Jun 14, 2006 (gmt 0)

10+ Year Member



Ok, I screwed up and allowed phpsessid in urls, now i need to get rid of them and therefore I am trying to find all requests including phpsessid and redirect them with a 301.
This is what i tried:

RewriteRule ^(.*)PHPSESSID(.*)$ [domain.tld...] [R=301,L]

* starting with any characters
* including PHPSESSID
* ending with any characters

Ok, the only problem i could possible think of is that the first "(.*)" matches the entire string and therefore "PHPSESSID" isn't matched. But I'm quite sure i've been using statements like this before, so please help me in this moment of dispair! What is wrong?

jdMorgan

3:31 am on Jun 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See RewriteCond [httpd.apache.org] %{QUERY_STRING} and RewriteCond %{THE_REQUEST}

Query strings (anything following "?") are not part of a URL, but rather, data attached to a URL to be passed to the resource at that URL.

Therefore, RewriteRule cannot 'see' the query string, and you must use RewriteCond.

Jim