【发布时间】:2016-12-05 16:37:57
【问题描述】:
我所有的请求都被重写到 index.php。请参阅下面的 .htaccess 文件。
IndexIgnore *
<IfModule mod_rewrite.c>
#Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>
</IfModule>
# END EXPIRES
<FilesMatch “.(ttf|otf|eot|woff)$”>
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin “*”
</IfModule>
</FilesMatch>
为了调试,我在 index.php 的第 2 行退出。请参阅下面的 index.php
<?php
exit('here');
session_start();
error_reporting(-1);
.
.
.
当我使用这个网址时 -
一切正常,即“这里”显示在浏览器中
但是当我使用这个网址时 -
我收到以下错误。
警告:未知:无法打开流:中没有这样的文件或目录 第0行未知
警告:无法修改标头信息 - 标头已发送 第0行未知
请注意,这只发生在特定服务器上。这两个 URL 在其他服务器和 localhost 上的工作方式和行为方式相同。两个 URL 之间的区别只是 url 编码。
我不能使用第一个 URL,因为当我使用 form.AjaxSubmit() 函数时,jQuery 会自动对我的请求正文进行编码。
【问题讨论】:
标签: php jquery ajax apache .htaccess