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 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失
  • ¥15 springboot+vue 集成keycloak sso到阿里云
  • ¥15 win7系统进入桌面过一秒后突然黑屏
  • ¥30 backtrader对于期货交易的现金和资产计算的问题