简体   繁体   中英

Trying to include the contents of htaccess in httpd.conf

I'm trying to include .htaccess inside httpd.conf for better performance.

I am following the instructions from the readme file here to improve site performance. I took the .htaccess and placed it in my website root folder C:/xampp/htdocs/apps then inside httpd.conf I've got the code below. then I restarted apache. The problem is i don't think the .htaccess rules are being applied

Is this the correct way of including .htaccess and am I including it in the correct directory?

<Directory "C:/xampp/htdocs">

    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted

    Include C:\xampp\htdocs\apps\.htaccess

</Directory>

If you want to "include" the contents manually in directory context with the Include directive, set AllowOverride to none, otherwise you are applying the same configuration twice, once in directory and another through AllowOverride method.

If you just want to have a .htaccess file (wouldn't figure why because you seem to have access to the main configuration), then AllowOverride all would be enough.

If you just want to .htaccess and make sure it is being applied you can just:

<Directory "C:/xampp/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

and add junk text in the .htaccess file inside this directory, if it is being read, Apache will responde with a 500 error, if it is not, chances are you are landing in another virtualhost where this directory is not set.

AllowOverride All

should already tell apache to let .htaccess override all settings. There is no need to include it manually i think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM