0

我正在尝试将我网站上的一个目录重定向到 https。该目录根本不是真正的目录,因为该站点是动态的。我使用 ExpressionEngine 作为 CMS。

我的 .htaccess 文件中已经有几行来删除 index.php ExpressionEngine 添加到其所有网址的内容。

这是我所拥有的:

<IfModule mod_rewrite.c>
        RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} store 
RewriteRule ^(.*)$ https://mysite.com/store/$1 [R,L]

        # Removes index.php
        RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php?/$1 [L]

</IfModule>

当我访问http://mysite.com/store/时,它会返回https://mysite.com/store/store/

我认为这可能与以下几点有关:

    RewriteRule ^(.*)$ /index.php?/$1 [L]

上面的行在 index.php 之后有一个问号,因为我收到“无输入文件”错误,这是推荐的修复方法。

有什么想法吗?

4

2 回答 2

0

这一行在这里:

RewriteCond %{REQUEST_URI} store 

!在“store”前面应该有一个:

RewriteCond %{REQUEST_URI} !store 

因为如果URI 已经是/store.

于 2012-11-30T06:36:21.370 回答
0

编辑了这一行:

RewriteRule ^(.*)$ https://mysite.com/store/$1 [R,L]

读书:

RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]

现在它起作用了。这是完整的代码:

<IfModule mod_rewrite.c>
        RewriteEngine On

        RewriteCond %{SERVER_PORT} 80
        RewriteCond %{REQUEST_URI} store 
        RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]

        # Removes index.php
        RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php?/$1 [L]

</IfModule>
于 2012-12-01T20:52:08.323 回答