.htaccess - 尝试将目录重定向到 https 但在返回时得到双 URL 段

标签 .htaccess ssl https expressionengine

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

我的 .htaccess 文件中已经有几行来删除 index.php ExpressionEngine 添加到它的所有 url。

这是我所拥有的:

<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 之后有一个问号,因为我遇到了“无输入文件”错误,这是推荐的修复方法。

有什么想法吗?

最佳答案

这里是这一行:

RewriteCond %{REQUEST_URI} store 

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

RewriteCond %{REQUEST_URI} !store 

因为如果 URI 已经是 /store,您希望它重定向。

关于.htaccess - 尝试将目录重定向到 https 但在返回时得到双 URL 段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13639770/

相关文章:

.htaccess - CakePHP 和 AngularJs 中的路由和谐 : htaccess rules to send user to index. html 或 bootstrap index.php

php - Wordpress 重定向循环错误

php - 将字符串保留在请求 uri 中

android - Android JSON 中的 SessionExpiredException 错误

linux - Curl 的证书问题

git - 为什么 git remote -v 不显示与我的 .git/config 相同的 url?

php - 将多个查询字符串转换为 php 中的 seo 友好 url

asp.net - 如何从受 SSL 保护的页面使用 jquery ajax 调用 WCF 服务?

apache - 在 MAMP 中的文件夹上将 http 转发到 https

apache - https 到 http 重定向