【问题标题】:Moving CodeIgniter website over to a new domain but same host将 CodeIgniter 网站移至新域但主机相同
【发布时间】:2016-05-08 14:40:51
【问题描述】:

我正在将我的 Web 应用程序移动到同一主机上的新域,我已经编辑了 .htaccess 文件,现在看到了一个重定向循环。新域没有 HTTPS,但旧域有 SSL 证书。我想对新域不使用 SSL。这是我在 .htaccess 文件中的内容:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]

【问题讨论】:

    标签: php apache .htaccess codeigniter ssl


    【解决方案1】:

    应该可以注释掉httpsRewriteRule

    尝试改变

    RewriteCond %{SERVER_PORT} 80 
    RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]
    

    #RewriteCond %{SERVER_PORT} 80 
    #RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]
    

    或者保留备份并删除这些行

    【讨论】:

    • 但是我想在域名前面保留 www?我现在看到找不到页面错误:(
    • 真的想要www?人们在没有它的情况下更容易输入地址,并且可以有一个将www 发送到非www 的规则
    • 所以我不应该添加rewritebase并添加新文件所在的新目录?
    • 问题没有提到目录结构的变化
    • 现在网站只是转到一个页面未找到错误
    猜你喜欢
    • 2015-06-09
    • 2016-07-26
    • 2018-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-10
    相关资源
    最近更新 更多