Reputation: 196
My current htaccess looks like this:
RewriteCond %{QUERY_STRING} !^ts=.*$ [L]
RewriteRule ^$ index.php? [L]
RewriteRule ^index\.html$ index.php [NC,L]
RewriteRule ^(set_language)-([a-zA-Z_0-9]+)\.html$ index.php?language=$2&%{QUERY_STRING} [NC,L]
RewriteRule ^([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)\.html$ index.php?g1=$2&%{QUERY_STRING} [NC,L]
RewriteRule ^([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)\.html$ index.php?g1=$2&province=$3&%{QUERY_STRING} [NC,L]
RewriteRule ^([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)\.html$ index.php?g1=$2&g2=$4&%{QUERY_STRING} [NC,L]
RewriteRule ^([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)-([a-zA-Z_0-9]+)\.html$ index.php?g1=$2&g2=$4&g3=$6&%{QUERY_STRING} [NC,L]
First two lines are for blocking the QUERY_STRING. Mainly on my page links are like
[TEXT]-[NUMBER].html
[TEXT]-[NUMBER]-[TEXT]-[NUMBER].html
etc. There is one link from contact form that containg GET value
?ts=[NUMBER]
I realy dont know how to block all QUERY_STRING's except the one from last link. Can someone help me solve this?
Upvotes: 1
Views: 76
Reputation: 786349
how to block all QUERY_STRING's except the one from last link
Use this rule:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} .+
RewriteCond %{QUERY_STRING} !^ts=[^&]*$ [NC]
RewriteRule ^ - [F]
Upvotes: 1