Youness
Youness

Reputation: 1495

denying access to sub folder by its real name using htaccess

i want to deny the user to acces the subfolder by its real name : the real name is "folder1" i want it to be accessed by an other name "test" i already done that using this :

RewriteRule ^(test/)(.*)$ /folder1/$2 [L]

it works fine but it still can be accessed by its real name (site.com/folder1) i already added this after the previous line :

RewriteRule ^(.*)(\/)(.*)$ error.php [L]

wich redirect any the user if he uses anything instead of the "test" but it also let him access it if he uses "folder1".

please some help.

Upvotes: 1

Views: 40

Answers (1)

killsarcasm
killsarcasm

Reputation: 51

Just turn off indexing on your site.

Add this to the top of you .htaccess file.

 Options -Indexes
 ErrorDocument 403 /

Upvotes: 1

Related Questions