dseigqk7443 2017-09-13 15:35
浏览 287
已采纳

使用AWS的HTTPS找不到Laravel路由

I just upgraded my HTTP to HTTPS through AWS(ACM) with ELB. My folder structure is like this,

htdocs-
    -index.html
    -myproject(laravel starts here)
      -index.php
      -folder(it contains config and all other folders)

Now without HTTPS Redirect code it works perfectly, but as soon as i add this code which is provided by AWS ACM my landing page comes perfectly but next route gives 404 error.

<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
</VirtualHost>

My laravel webpage starts from,

https://www.spontieapp.com/mobile

my httpd.conf content is , https://pastebin.com/ArUDP6Xg

my .htaccess is , https://pastebin.com/wU72Zbau

.htaccess is present under /mobile folder

Please assist on resolving it . Thanks

  • 写回答

1条回答 默认 最新

  • dongnong3799 2017-09-13 16:23
    关注

    Try the following rewrite rules:

    RewriteEngine On
    # This will enable the Rewrite capabilities
    
    RewriteCond %{HTTPS} !=on
    # This checks to make sure the connection is not already HTTPS
    
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
    # This rule will redirect users from their original location, to the same location but using HTTPS.
    # i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
    # The leading slash is made optional so that this will work either in httpd.conf
    # or .htaccess context
    

    https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

    ... you will need to ensure that you place this in a .htaccess file in the root of the site you want to apply it against, and to make sure you have the appropriate AllowOverride configuration in your httpd.conf

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持