Reputation: 67
My main problem is that i got a lot of directories that i want to hide from the customer visiting my website.
my base url: http://example.com/qf/development/templates/webApp/
What i want to hide for the visiting customer is these directories "/qf/development/templates/"
I have tried with the following in my .htaccess file in the directory http://example.com/.htaccess in the web root
This is whats inside my .htaccess file but not working..
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^qf$ qf/development/templates/webApp/index.php
Upvotes: 1
Views: 216
Reputation: 41209
You can try this rule
RewriteEngine on
RewriteBase /
RewriteRule ^qf/?$ qf/development/templates/webApp/index.php [L,NC]
This will redirect www.example.com/qf to www.example.com/qf/development/templets/webApp/index.php
Or
Add the following line to your .htaccess file
IndexIgnore *dir
This tells the Apache web server to list all files except those that is in the IndexIgnore
example 1 add the following line to your .htaccess file if you want to hide a directory named foo
IndexIgnore *foo
example 2 add the following line to your .htaccess file if you want to hide a file that ends with .bar
IndexIgnore *.bar
If you want to disable all files and directories form listing ,Add this line to your .htaccess
IndexIgnore *
The wildcard '*' means it will not display any files
Upvotes: 0
Reputation: 13270
My solution :
in your current .htaccess :
RewriteEngine off
Options -Indexes
This will prevent the directories listing of all the hierarchy from your root.
In your document root, you create a index.php containing :
<?php header('Location: http://example.com/qf/development/templates/webApp/');
in /qf/development/templates/webApp/
, you just create the index.php (disallowing directories listing will not disallow files access, index.php will still be requestable).
Upvotes: 0