Can you filter/inspect POST method/requests with htaccess?

Viewed 167

Can you filter/inspect POST method/requests with htaccess For example, if you want to filter a $_GET variable with htaccess to redirect if a pattern is matched, it would look like this:

RewriteCond %{QUERY_STRING} <script> [NC]
RewriteRule .*$ /mylogPage.php? [L,R=301]

Can you do a similar filter for $_POST variables?

I have tried many variations including an attempt to modify mod_security through htaccess. I assume in htaccess it will have something to do with:

RewriteCond %{REQUEST_METHOD} POST.

I have tried

RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} <script> [NC]
RewriteRule .*$ /mylogPage.php? [L,R=301]

But it only redirected the page

If this should be done through mod_security, can one edit mod security through htaccess? What would the syntax look like? I have tried but was not successful.

2 Answers

I have done research and spoke to my hosting company as well. If you are on shared hosting, all domains on the same server share the same settings for mod_security,so it is not possible to access and/or edit mod_security through htaccess. If that was possible, you would modify mod_security to affect all website on the server. On shared hosting it is only possible to inspect $_GET variables through htaccess.

In case you are on shared facilitating, all spaces on a similar worker share similar settings for mod_security, so it is absurd to expect to get to or potentially alter mod_security through htaccess. In case that was conceivable, you would change mod_security to influence all site on the worker. On shared facilitating it is simply conceivable to review $_GET factors through htaccess.

Related