简体   繁体   中英

.htaccess, <Directory />, gives Internal Server Error, 500

Where and how to use <Directory /> in order to prevent files and folder access in the / . <Directory /> gives for me 500 Internal Server error.

.htaccess

#if i add the next 6 lines (10 lines), i am getting the error "Internal Server Error"

    <Directory />
        Order deny,allow
        Deny from all
        Options None
        AllowOverride All
    </Directory>

    <Directory /web>
      Order Allow,Deny
      Allow from all
    </Directory>

    RewriteEngine On
    RewriteBase /
    Options -MultiViews
    DirectoryIndex /web/index.php

    RewriteCond %{HTTP_HOST} ^somedomain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.somedomain\.com$
    RewriteRule ^/?$ "https\:\/\/somedomain\.com" [R=301,L]

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteCond %{ENV:REQUEST_FILENAME} !-d
    RewriteCond %{ENV:REQUEST_FILENAME} !-f
    RewriteCond %{ENV:REQUEST_FILENAME} !-l
    RewriteRule ^(.*)$ /web/index\.php?url=$1 [QSA,L]

Directory location must contain full relative path including /var/www/ or whatever you have there.

Hope it helps!

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