简体   繁体   中英

SetEnv in xampp/apache .htaccess returns error 503

My .htaccess file

    SetEnv PERCORSO_GLOBALS "D:\WEB\htdocs\globals.php"

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-s
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.*$ index.php [NC,L]

    ErrorDocument 400 /errors/400badrequest.html
    ErrorDocument 401 /errors/401authreqd.html
    ErrorDocument 403 /errors/403forbid.php
    ErrorDocument 404 /errors/404notfound.php
    ErrorDocument 500 /errors/500serverr.html
    ErrorDocument 503 /errors/503servunav.html

    Options All -Indexes

At home this files works with xampp end PERCORSO_GLOBALS is correctly set and can be use in php with $_SERVER['PERCORSO_GLOBALS'] .

On my office computer, same configuration (Win7+xampp), i get always the 503 error.

NB the error I get is not the standard 503 error, but my personal 503 error setted on the .htaccess file ( ErrorDocument 503 /errors/503servunav.html )

If I remove from the file this line:

    SetEnv PERCORSO_GLOBALS "D:\WEB\htdocs\globals.php"

then the server works... But I need this enviroment variable everywhere, cause I include this file on each other file.

What should I change to make it works?

Thank you.

尝试改用SetEnvIf

SetEnvIf Request_URI "^" PERCORSO_GLOBALS=D:\WEB\htdocs\globals.php

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