Home > Software design >  .htaccess only protecting folder sometimes
.htaccess only protecting folder sometimes

Time:10-23

Website

https://ochab.us

Desired behaviour

When you click on any of the projects on the homepage, for it to require a password before taking you to that page.

Actual behaviour

If you go directly to the project page (https://ochab.us/work-locked/security-platform), it requires a password. This is correct.

If you go to https://ochab.us and right click, "Open in a new Tab" on one of the projects, it requires a password. This is also correct.

If you go to https://ochab.us/ and click on a project it somehow skips the password protection. This is the issue I'm trying to fix.

The code

I have a site structure setup like this:

/index.html
/work-locked/project-1/index.html
/work-locked/project-2/index.html
/work-locked/project-3/index.html
/work-locked/project-4/index.html

I set up /work-locked/.htaccess to look like this:

AuthType Basic
AuthName "Please message me via my contact page to get access."
AuthUserFile /my-path/.htpasswd
require valid-user

I wondered if the password was cached, but I've tried it in different browsers and via BrowserStack and the same result.

MediaTemple is my host.

Thanks!

CodePudding user response:

I ended up updating the links from: <a href="/work-locked/project-name"> to <a href="//ochab.us/work-locked/project-name">

It's going to make developing locally a bit of a pain, but since this is a pretty small project I'm okay with that.

  • Related