【问题标题】:.htaccess file not redirecting properly in Codeigniter app.htaccess 文件未在 Codeigniter 应用程序中正确重定向
【发布时间】:2018-07-07 12:44:02
【问题描述】:

我有一个使用 MAMP 在我的本地计算机上运行的应用程序,但无法重定向到实时服务器上的某个页面。我已将其缩小到 .htaccess 文件,但似乎无法获得确切的配置。当我在基于 Codeigniter 的应用程序上注册用户并且它应该重定向到另一个页面时会发生这种情况,但没有。

这是我目前拥有的,

RewriteEngine on
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://website.com/$1 [R,L]
# Hide all PHP files so none can be accessed by HTTP
RewriteRule (.*)\.php$ index.php?/$1

# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

【问题讨论】:

    标签: .htaccess codeigniter mamp


    【解决方案1】:
    RewriteEngine on   
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301,NC]
    

    尝试这样使用

    【讨论】:

      猜你喜欢
      • 2019-02-09
      • 2011-12-17
      • 1970-01-01
      • 2018-06-08
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多