Jump to content

.htaccess file issue


matfish

Recommended Posts

Sorry - didn't know which section to post this in...

 

Is there a way to allow the root index.php file to be displayed to all, however making all other directories password protected without putting a .htaccess file in every directory?

 

The idea being I would like a holding page to be present on the root of the domain, but start development beyond that which would be password protected?

 

Many thanks

Link to comment
Share on other sites

Thanks for the reply, I have already put a robots.txt file in place and I know that crawlers are supposed to abide by these rules set - however in the past I have still found blog related pages on Google/Yahoo listings before it's offical launch.

 

Which is why I wanted something a bit more secure.

 

Many thanks

Link to comment
Share on other sites

UQ13A

 

That will only stop people listing the contents of a directory and redirect them if they try to do so or visit the index page. It will not stop them viewing other files in the same folder.

 

 

Ben

Link to comment
Share on other sites

This should do it... The "RewriteRule" says that if the path part of the URL does not start with "/index.php" then -- the "-" means do not rewrite the URL, just process the flag (which is the last part in square brackets) -- the "[F]" means send back a "Forbidden" response, which is an HTTP 403 message header

 

RewriteEngine On

RewriteRule !^/index.php - [F]

 

 

Link to comment
Share on other sites

No he requested that Index.php was shown and all other directories where password protected.

 

Your solution simplies gives them a 403 error if he or anyone else trys to access any other file than index...

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.