2015-08-23 23:22
采纳率: 100%
浏览 54


I have a website with my front controller in a subdirectory. Then I would like to transparently redirect root folder of the site to subdirectory. Moreover, I have SSL enabled and want to force it for the site.

I succeeded in transparently redirecting root folder to subdirectory by doing this in .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ web/$1 [QSA,L]

So I decided to add https to the RewriteRule like this : RewriteRule ^(.*)$$1 [QSA,L]. But I don't get what I want. In fact, I get https forcing but the transparent root folder to subdirectory redirection does not work anymore. I got in my address bar : though my wish is to have

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongmoyu0336 2015-08-23 23:36

    Your added rule is implicitly treated like a redirect. Just put it prior to the rule that does the web/ rewrite. This allows you to change the protocol first then continue with your internal rewriting after the request returns on https.

    edit: More detail on HTTPS redirect:

    打赏 评论

相关推荐 更多相似问题