我有几个问题,第一个是我的apache2服务器不读取.htaccess
我有像这样的apache2.conf安装程序:
# AccessFileName: The name of the file to look for in each directory # for additional configuration directives. See also the AllowOverride # directive. # AccessFileName .htaccess # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <FilesMatch "^\.ht"> Order allow,deny Deny from all </FilesMatch>
我使用a2enmod headers启用了a2enmod headers
在.htaccess ,我有:
Header set Access-Control-Allow-Origin "*"
当试图通过JavaScript文件访问时,我得到:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
我补充说:
Header set Access-Control-Allow-Origin "*"
每次我编辑apache2.conf我重新启动apache2 service apache2 restart
到apache2.conf ,而是给我一个500 internal server error 。 我可以通过浏览器访问页面,但通过JavaScript,我不能。 我能做些什么来解决这个问题?
事实certificate,我不得不打开mod_rewrite( a2enmod rewrite )和.php文件有错误,我看不到,为此我使用:
<?php error_reporting(E_ALL); ini_set("display_errors", 1); include("file_with_errors.php"); ?>
从PHP手册网站上,在这个页面上: http : //www.php.net//manual/en/function.error-reporting.php
另外,如果您想要一直打开错误报告(我曾经这样做),请在php.ini更改以下内容:
display_errors = Off
-至-
display_errors = On
是理想的。