/    Sign up×
Community /Pin to ProfileBookmark

Htaccess, password and php files

I want to password-protect a directory within my website. I create an .htaccess file with all of the needed lines, I create an encrypted password file, etc. It seems to work just OK.

Now, if I type not only the directory (e.g. mywebsite.com/blog) but also the file (mywebsite.com/blog/index.php), it asks for a password, yet, if I press “Cancel” repeteadly, lo!, the page DOES load, even if not loading all of the images, etc.

Any idea about it? I’d like to make it so that even if a person should try and type the whole URL including the .php, they wouldn’t be able to access that directory .

Is there any way I can improve my .htaccess file? I understand you can password protect only one file, if you want. Would protecting index.php too help? (And how can it be done?)

to post a comment
Full-stack Developer

1 Comments(s)

Copy linkTweet thisAlerts:
@_lt_Eddie_gt_May 07.2006 — It's very hard to improve code when you haven't submitted it for review. Also, ensure the files are uploaded in ASCII format, not binary. Strange symptoms indeed.
×

Success!

Help @Seanver spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...