【发布时间】:2012-10-30 21:40:25
【问题描述】:
我在我的 Apache .htaccess 文件中使用重定向将所有流量从 index.html 发送到 mydomain.com。为此,我使用以下内容:
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://www.mydomain.com/$1 [R=301,L]
我现在遇到的问题是在使用 AJAX 将内容调用到 <div> 时使用到我主页的相对路径。
如果我想从 /index.html 获取内容,我会收到 404 错误。我可以通过使用绝对路径来解决这个问题,即。 “http://mydomain.com”,但是有没有办法我仍然可以使用主页的相对路径?
【问题讨论】:
标签: javascript ajax .htaccess http-status-code-301