user3782638
user3782638

Reputation: 139

htaccess rewrite url contains

I'm trying to block some urls in my site, for example i want to "ban" urls and give them 403 when contains words like options, k2 or component. The problem is that htaccess not work properly

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(option|k2|component) [NC]
RewriteRule .* - [F]
</IfModule>

Is blocking when bot attack www.example.com/option=?asdasdad but its not blocking when bot is attacking www.example.com/index.php/option=?asdad

Anyone?

Upvotes: 1

Views: 76

Answers (1)

Mohammed Elhag
Mohammed Elhag

Reputation: 4302

Remove the above and Put only the following code :

 RewriteEngine on
 RewriteRule (option|k2|component) - [F]

Upvotes: 2

Related Questions