Git Product home page Git Product logo

apachehtaccessin's Introduction

ApacheHtaccessIn

Often when you get a Web App there will be several .htaccess files sprinkled through the app, and Apache will read these to make sure it serves the app properly.

Problem: it is better for performance if these configs are baked into Apache, instead of getting apache to look for .htaccess files.

http://httpd.apache.org/docs/current/howto/htaccess.html

This library is a simple library that will search through a directory for .htaccess files and make them into an Apache config for you.

Use from the command line

Say you have this Apache Config

<VirtualHost example.com>
    DocumentRoot /var/www/example.com/web
    <Directory /var/www/example.com/web >
        AllowOverride all
    </Directory>
</VirtualHost>

Check out the code and run

php bin/ApacheHtaccessIn.php /var/www/example.com/web >> /var/www/example.com/apacheConfig

Then simply change your config to

<VirtualHost example.com>
    DocumentRoot /var/www/example.com/web
    <Directory /var/www/example.com/web >
        AllowOverride none
    </Directory>
    Include /var/www/example.com/apacheConfig
</VirtualHost>

Reload or restart Apache. Done!

Every time you do something that might change your .htaccess files, such as upgrade the app, you will need to rerun this and reload or restart Apache.

Note: the output file created contains complete paths. This means if you move the web app - say from /var/www/example.com/web to /websites/example.com/web you will need to rerun this.

Run from PHP

This can be included with composer: https://packagist.org/packages/jmbtechnologylimited/apachehtaccessin

For an example of how to call the PHP classes, see bin/ApacheHtaccessIn.php

License

BSD - for details see LICENSE.txt

apachehtaccessin's People

Contributors

jarofgreen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.