Giter VIP home page Giter VIP logo

Comments (5)

QWp6t avatar QWp6t commented on August 16, 2024

It's literally the first line of code.

add_action('generate_rewrite_rules', __NAMESPACE__ . '\\ApacheServerConfig::init', -9999, 0);

There's not much else that I know of that I can do besides set it to the lowest priority like that so that it hopefully gets processed first.

I have noticed that sometimes it's not first, and I'm not sure why, but I also didn't care. WordPress only has rewrite rules, so this really isn't that big of a deal, imo.

If you want to give it a shot and send a PR, feel free.

from wp-h5bp-htaccess.

VR51 avatar VR51 commented on August 16, 2024

Will test at some point during the the next fortnight.

Thanks again.

from wp-h5bp-htaccess.

bryanwillis avatar bryanwillis commented on August 16, 2024

@QWp6t you might be able to use PHP_INT_MIN if you want to make sure the priority is as low as possible.

add_action('generate_rewrite_rules', __NAMESPACE__ . '\\ApacheServerConfig::init', PHP_INT_MIN, 0);

from wp-h5bp-htaccess.

QWp6t avatar QWp6t commented on August 16, 2024

That's only for PHP 7.0+.

But it's not absolutely necessary to be the very first, so I'm not concerned about that.

from wp-h5bp-htaccess.

VR51 avatar VR51 commented on August 16, 2024

It is necessary to be first for some of the directives to be effectual.

.htaccess is read from top to bottom and directives are observed in read-order. Once the WordPress rewrites are reached, WordPress takes over for virtual files and directories that are managed by WP and thus applies WP PHP based rewrites.

For example, where we want to deny access to a file or directory, if WP kicks in before the .htaccess directive that blocks access to a document that is read by Apache then that directive might not be observed in time to prevent the document being served.

Another example, the directives that gzip output are best placed at the top of .htaccess so they take effect immediately and not after the files have already been served.

Placement does matter.

Maybe prepend the directives to htaccess and include DirectoryIndex at the top?

from wp-h5bp-htaccess.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.