apache html request parameters
Question
is there any way to disable/drop queries to html contents.
GET /alaswaq_property.html?d691f
GET /alaswaq_property.html?48fae
GET /alaswaq_property.html?8c106
GET /alaswaq_finance.html?fe082 if request contains filename.html?xxx then block it only allow filename.html < is this possible?
thanks in advance.
Solution
In your htaccess file or vhost config, add:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^[A-Za-z0-9]{5}$
RewriteRule \.html$ - [F,L]
If you want to simply include any query string at all, change the RewriteCond
line to:
RewriteCond %{QUERY_STRING} !^$
OTHER TIPS
Yes, you can use mod_rewrite to do this.
RewriteRule ^/alaswaq_property.html /alaswaq_property.html?
See http://wiki.apache.org/httpd/RewriteQueryString for stuff you can do for query string manipulation.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow