Forum Moderators: open

Message Too Old, No Replies

htaccess avoidance

Always read

         

Wayder

7:22 pm on Jun 18, 2023 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hi,

Is htaccess always served or are there any occasions when it isn’t?

Thank you

Wayder

8:55 pm on Jun 18, 2023 (gmt 0)

10+ Year Member Top Contributors Of The Month



For context:

I have been using a php file include in my headers but there seems to be quite a few "visitors" that don’t get to that stage so I am thinking of adding the checks into .htaccess file using auto_prepend_file so that it catches everything that gets to the site.

I just want to check that it WILL catch every visitor.

Thank you

not2easy

9:34 pm on Jun 18, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It might be due to PHP includes being added prior to/during render of the html while .htaccess does its work prior to the page/content being served. PHP is server-side while .js loads after/during the page is rendered.

I've read that the Chrome browser caches/pre-loads pages to seem faster. Those might be the visits that do have the header code.

I hope someone will be by to translate that better...lucy24?

lucy24

10:52 pm on Jun 18, 2023 (gmt 0)

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



Is htaccess always served
Quibble: htaccess is never served. But it is always read, where “always” means on each request whose physical filepath passes through the directory containing the htaccess file, and “request” means both external requests (the ones that show up in your access logs) and internal requests (for example, include files or error documents). That, in turn, means htaccess might be read more than once for a single external request.

So the answer depends on where the php include file is physically located.

Wayder

9:55 am on Jun 19, 2023 (gmt 0)

10+ Year Member Top Contributors Of The Month



Quibble accepted :)

>> is always read, where “always” means on each request whose physical filepath passes through the directory containing the htaccess file.

That's what I thought and need. Thank you for the clarification.

phranque

9:54 pm on Jun 19, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you should read the documentation regarding the AllowOverride directive and pay close attention to your application thereof:
https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride

phranque

1:18 am on Jun 20, 2023 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



more specifically, this is relevant:
When this directive is set to None and AllowOverrideList is set to None, .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.

Wayder

11:22 am on Jun 20, 2023 (gmt 0)

10+ Year Member Top Contributors Of The Month



One of these moments when I realise how little I know :(

Off for a little light reading now....

Thank you

lucy24

4:11 pm on Jun 21, 2023 (gmt 0)

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



Touché :) I started from the premise that htaccess is permitted. Shoulda started one step earlier.

Wayder

10:15 pm on Jun 21, 2023 (gmt 0)

10+ Year Member Top Contributors Of The Month



>>Shoulda started one step earlier
Noooo……! That would have confused me even more although the link phranque gave has opened new paths to me (thank you).

It’s a bit like when you discover <?php echo “Hello world”; ?> and believe you are master of all you survey and then you come across something that just looks like gobbledygook. Gulp!

Anyway, since I started this journey last month, I have managed to identify and stop about 85%~90% of unwanted visitors and I wish to thank you all for helping my on my journey so far. It’s a work in progress.

Thanks

tangor

7:10 am on Jun 22, 2023 (gmt 0)

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



And the beauty of that progress is that it never stops! (Still progressing since joining in 2005!)

And ... thanks to all along the trail from "Back Then to Here and Now".