Forum Moderators: phranque

Message Too Old, No Replies

htaccess and https - https not reading .htaccess

https://example.com/ not reading .htaccess

         

Andova

11:40 am on Apr 27, 2022 (gmt 0)



I have been searching for this for a long time... Web Search engines just ain't right for this kind of search...

Basic Fact: http://example.com/ w/Apache reads .htaccess file, right? (If not configured to not do so.)
But my hosted website and https://example.com/ DOES NOT read .htaccess file.

That is HTTP ok; HTTPS not ok... (Maybe I should just bang my head on concrete.)

If I have not explained that right I will try better. Site uses let's encrypt and .well-known, if that helps.

not2easy

12:21 pm on Apr 27, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hello Andova and welcome to WebmasterWorld [webmasterworld.com]

The domain does not read .htaccess, the server reads and executes it. It is easy to confuse the server by putting things in unexpected places or using unexpected syntax.

The rule to automatically deal with canonicalization (sending all requests from http: - with and without www to a single version of the domain) needs to be in the right place and format. If you are using Apache's mod_rewrite, don't confuse it by also using mod_alias.

It helps to share the actual lines in question from your .htaccess file to get help with things. I see that you understand to use "example.com" to discuss these things, thank you for that.

lucy24

3:50 pm on Apr 27, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But my hosted website and https://example.com/ DOES NOT read .htaccess file.
The HTTP and HTTPS versions of the site use the same files, living in the same location on the same server. You’ll need to explain what you are observing that leads you to think one version is disregarding htaccess.

phranque

9:10 pm on Apr 27, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The HTTP and HTTPS versions of the site use the same files, living in the same location on the same server.

this is not necessarily true.

But my hosted website and https://example.com/ DOES NOT read .htaccess file.

if you have access to your server config files, you can look at the DocumentRoot directive(s) in the VirtualHost container(s).
your https: site may be using a different document root directory than the http: site.

w3dk

11:32 pm on Apr 27, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



You also need to ensure that the appropriate "AllowOverride" directive is set for both the HTTP and HTTPS vHosts to enable ".htaccess" overrides.

lucy24

12:06 am on Apr 28, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Now, wait. I can see where separate vhosts might have diferent AllowOverride settings, whether by accident or by design. But if the http and https sites use physically different files, wouldn't they also require entirely separate htaccess? In that case it's no longer a simple matter of reading it or not reading it; they each have to say exactly the same thing.

if you have access to your server config files
Normally you wouldn't, though--I mean “you” = OP--or we wouldn't be talking about htaccess at all.

let's encrypt and .well-known are relevant in that they imply everything is happening on the same server, rather than being routed via a cdn or similar. (And where would /.well-known/ be located if http and https are run through different directories?)

phranque

2:32 am on Apr 28, 2022 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



But if the http and https sites use physically different files, wouldn't they also require entirely separate htaccess?

that's what i am implying.
if you have access to your server config files
Normally you wouldn't, though--I mean “you” = OP--or we wouldn't be talking about htaccess at all.

if you don't have access to the server config files, you probably have access to some type of server console application that will show the "server admin" various config settings for each configured virtual host, including the document root directory location.