【问题标题】:Codeigniter .htaccess not ignoring directoriesCodeigniter .htaccess 不忽略目录
【发布时间】:2012-09-16 14:58:21
【问题描述】:

我有一个基于 codeigniter 的网站,并正在尝试让 PP IPN 使用它。我查看了一些特定于 CI 的库,但希望有一个独立的 IPN 文件。

基本上,我在网站根目录中安装了 CI,我还有另一个目录“pp”,也在根目录中。

我正在尝试使用 Paypal 的沙箱测试 IPN,但它返回 404,我也无法直接访问该文件。

这是我的 .htaccess 文件:

XSendFile on
Options -Indexes
Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

### Canonicalize codeigniter URLs
RewriteRule ^(index(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]

# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond %{HTTP_HOST} !^(www) [NC]
RewriteRule ^(.*)$ http://www.mysite.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|pp|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>

希望它真的很明显!

谢谢,

瑞恩

【问题讨论】:

    标签: .htaccess codeigniter paypal paypal-ipn


    【解决方案1】:

    您是否启用了 mod_rewrite.c。如果不是,则 .htaccess 将始终给出 404。(抱歉,我无法对此发表评论,没有代表)。

    【讨论】:

      【解决方案2】:

      如果pp 目录存在,您可以在该目录中放置一个 htaccess 文件,然后:

      RewriteEngine On
      

      它本身,主 htaccess 文件中的任何规则都将被忽略。如果您的贝宝内容已经在 pp 目录中的 htaccess 文件中具有重写规则,您可能需要查看这些规则作为 404 的原因。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-07-20
        • 1970-01-01
        • 1970-01-01
        • 2019-03-13
        • 1970-01-01
        相关资源
        最近更新 更多