Magento – How to Block RSS in .htaccess

.htaccessmagento-1.7Security

I need to block RSS pages in htaccess, most importantly these

/rss/catalog/new
/rss/catalog/notifystock

and

/index.phprss/catalog/notifystock

Especially the last one, as you can see it's /index.phprss/ without a slash in between, it works when added in front of domain name, I need to block it.

Could someone please add a rewrite code?

Best Answer

Rule works on 1.7:

RewriteCond %{REQUEST_URI} ^/(index.php/?)?rss/ [NC]
RewriteCond %{REMOTE_ADDR} !^1.1.1.1
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=302,L]

The rule below is the rule Magento instructions provide, it doesn't work.

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(index.php/?)?rss/ - [L,R=403]

If anyone see issues with the original rule, please let me know.

Related Topic