【发布时间】:2018-12-09 19:41:01
【问题描述】:
我对来自 htaccess 的 php_value auto_prepend_file 有疑问。它给了我 500 内部服务器错误。以下 htaccess 代码在 localhost 上运行良好,但在在线服务器上给我 500 Internal Server Error。问题出在哪里,解决方案是什么?任何人都可以在这方面帮助我吗?
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /script/
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ %1 [R=302,NE,L]
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*)index\.php$ $1 [L,R=302,NC,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^post/([\w-]+)/?$ sources/post.php?msgID=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteRule ^(.+?)/?$ index.php?pages=$1 [L,QSA]
php_value auto_prepend_file "/home/*****/public_html/script/path.php"
【问题讨论】:
-
@anubhava 亲爱的没有关于500错误的任何错误只有这个错误:
File does not exist: /home/*****/public_html/404.shtml -
先检查下面的答案。我相信您的 htaccess 没有使用 Directory 指令。
-
@anubhava 错误是这样的:
/home/******/public_html/script/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration -
@anubhava tobias-k 答案意味着您的赏金答案并非无处不在。我已经在我的本地主机上使用了你的答案。
标签: .htaccess