Restricting subfolder via htaccess conflicting with rewrites

Hi, i’m working with an installation of Wordpress installed in the root directory.

I wanted to set permissions (user and password) to a sub folder. I did this by both trying to auto generate the necessary .htaccess file from the cpanel as well as just doing it manually. However, instead of the access popup I would get a “page not found” error/page of my root directory roots theme.

Discussing this with my hosting they said it was because of a weird .htaccess file. We regenerated it and sure enough the subfolder user name and password popup worked.

However, this of course messed up my roots theme install. I resaved the permalinks, but then I was back to my original issue.

Any ideas on this?

Do you have the Roots rewrites plugin enabled? Or an older version with rewrites? If so, that could be problem. If not, this just seems like a normal WP/Apache config problem and nothing to do with Roots.

I just tried again for good measure. When the plugin is disabled it works and I downloaded a fresh copy of it.

Strange. Maybe something with Bluehost. It’s not a huge deal. Just wondering. Wondering enough where I have spent the last few hours tinkering with it. I can’t help myself.

Personally, I wouldn’t bother with the rewrites. It’s almost pure vanity. Moving to Bedrock would tidy up the asset urls as a small part of its many benefits.

That being said you can try my branch of the rewrites plugin to see if that helps at all (it probably won’t) or paste the contents of your .htaccess to possibly highlight any conflicting rules.

So, if anybody happens to have the same issue I had (maybe rare), my hosting and I figured out that in the .htaccess file I needed to add an extra forward slash on one of the rewrite rules. They actually had no idea why, but dug it up in some old article. Funny.

As below:

RewriteRule ./ /index.php [L]