【问题标题】:.htaccess broke my ajax.htaccess 破坏了我的 ajax
【发布时间】:2014-04-14 19:52:07
【问题描述】:

我尝试使用 .htaccess 删除 url 的 index.php 部分,现在即使我删除了 .htaccess,ajax 内容也不再加载。这是 .htaccess 的样子:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Chrome 给我的错误如下所示:

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://jolinmasson.com/ajax/page:6?_=1397504793977

【问题讨论】:

  • 之前 ajax 工作正常吗?
  • 是的。甚至没有另一个 .htaccess…

标签: php ajax .htaccess


【解决方案1】:

终于设法让它与那个 .htaccess 一起工作

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteBase /

RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
RewriteRule ^site/(.*) error [R=301,L]
RewriteRule ^kirby/(.*) error [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>

【讨论】:

    猜你喜欢
    • 2012-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-18
    • 1970-01-01
    • 2018-06-06
    • 1970-01-01
    相关资源
    最近更新 更多