Rich5757
Rich5757

Reputation: 155

Block some internal urls using .htaccess in cakephp

My site is running on cakephp 2.0 version , I want to block some of my site urls.

for example

www.exmaple.com/users/register
www.example.com/users/login

I tried to modify the .htaccess file of root , as well inside app folder but nothing work.

my code is

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
   RewriteCond %{REQUEST_URI} ^/register
   RewriteCond %{REQUEST_URI} ^/login
</IfModule>

Please help , how can I achieve it.

Thanks

Upvotes: 1

Views: 83

Answers (1)

anubhava
anubhava

Reputation: 785156

You can use these rules:

<IfModule mod_rewrite.c>
   RewriteEngine on

   # block these URIs
   RewriteRule (register|login) - [F,NC]

   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

Upvotes: 1

Related Questions