Not recognising my query string

Oh, the strange things mod_rewrite does!

Not recognising my query string

Postby clive » Mon Oct 05, 2009 10:42 am

I have a RewriteCond set as follows:

RewriteCond %{QUERY_STRING} lang=en

there is also a following RewriteRule

If I have a url of http://www.mysite.com/France?lang=en
this gets picked up by the RewriteCond ok.

If I have a url of http://www.mysite.com/Accom/Prog1.php?lang=en
this gets ignored.

If I have a url of http://www.mysite.com/Accom/Prog2/N/352/?lang=en
this gets ignored also

Have I coded the RewriteCond properly to pick up all query string cases?

Any help is appreciated :x
clive
 
Posts: 5
Joined: Thu Oct 01, 2009 8:54 pm
Location: France

Postby richardk » Mon Oct 05, 2009 12:13 pm

What is your full mod_rewrite?
Do you have mod_rewrite in the sub directories?

Have I coded the RewriteCond properly to pick up all query string cases?

The RewriteCond will match all query strings that contain the string "lang=en" but the rest of the rule set is also important.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby clive » Mon Oct 05, 2009 8:57 pm

Hi Richard

there are no subdomains involved in this.

I am just trying to strip the query strings out of some url's in the main domain that should not have been there.

The full rewrite rule is:
RewriteCond %{QUERY_STRING} lang=en
RewriteRule .? http://www.mysite.com%{REQUEST_URI}? [R=301,L]
clive
 
Posts: 5
Joined: Thu Oct 01, 2009 8:54 pm
Location: France

Postby richardk » Tue Oct 06, 2009 10:19 am

there are no subdomains involved in this.

Sub DIRECTORIES, ie. folders. /Accom, /Accom/Prog2, /Accom/Prog2/N and /Accom/Prog2/N/352. Are there any .htaccess files in them?

What happens if you do it without the RewriteCond?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby clive » Tue Oct 06, 2009 10:33 am

Hi Richard,

got it in 1

There was another .htaccess file in a directory that was causing the problem.

Many thanks
clive
 
Posts: 5
Joined: Thu Oct 01, 2009 8:54 pm
Location: France


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 2 guests

cron