Forum Moderators: phranque

Message Too Old, No Replies

Invalid folder query strings

remove invalid query strings from folder

         

cheaperholidays

4:46 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



Hi every one

We have a folder /late-deals/?m200067with non valid query strings

How do we get rid of these, and does the rule go into the root htaccess or the late-deals/ folder

I have tried

RewriteCond %{query_STRinG} &?m([0-9][0-9])$
RewriteRule ^late-deals$ http://www.example.com/late-deals/? [R=301,L]
Which did nothing..

And

RewriteCond %{query_STRinG} ^m
RewriteRule ^late-deals/$ http://www.example.com/late-deals/late-deals/? [R=301,L]

Many Thanks and Merry Christmas to you all

[edited by: jdMorgan at 4:56 pm (utc) on Dec. 23, 2006]
[edit reason] Examplified. Please see TOS. [/edit]

jdMorgan

4:55 pm on Dec 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Several minor problems, there. I'd suggest:

RewriteCond %{[b]QUERY_STRING[/b]} &?m[b][0-9]+&?[/b]
RewriteRule ^late-deal[b]s/?$[/b] http://www.example.com/late-deals/? [R=301,L]

As written, this code would go in your Web-root .htaccess.

I assume you already have other working rules in that file, so I have omitted the mod_rewrite 'setup' stuff.

Jim

cheaperholidays

5:23 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



Thanks JD

This rule does nothing

The late-deals folder is a wordpress blog if this makes any difference.
We use this rule for eg

RewriteCond %{QUERY_STRING} .
RewriteRule ^corfu-weather-forecast\.htm$ http://www.example.com/corfu-weather-forecast.htm? [R=301,L]

to kill of invalid strings on pages and it works a charm

However on this folder we have a problem

DirectoryIndex index.php

RewriteEngine on

Options +FollowSymLinks

RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule \.htm$ - [G,L]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /late-deals/
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /late-deals/foo.php [L]
</IfModule>

# END WordPress

Thanks

[edited by: jdMorgan at 5:36 pm (utc) on Dec. 23, 2006]
[edit reason] Examplified. [/edit]

cheaperholidays

7:08 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



THanks Jd

Got it to work after a bit of messing around the rule had to go in the folder and not root

Thanks for all your help