【发布时间】:2015-03-18 07:15:51
【问题描述】:
我已经安装了 opencart 2.0.1.1,我需要将 https://www.domain.com 重定向到 http://www.domain.com。如何使用 htaccess 文件实现它。
我已在 htaccess 文件中尝试过此代码。但这不起作用。
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
我应该如何将 https URL 重定向到 http。我还在 opencart 中检查了 config.php 文件,它不包含任何 https URL。
opencart现有的htaccess文件包含如下代码
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
但该文件不是 htaccess 文件。它只是一个名为 htaccess.txt 的文本文档。
提前致谢。
【问题讨论】:
-
什么具体不起作用?
-
当我运行 https url 时,它不会重定向到 http。
-
应该可以。您确定您的服务器配置为允许 .htaccess 文件吗?你还有其他的 htaccess 文件在使用吗?
-
是的,我允许 htaccess 文件工作。我尝试重定向 index.php 文件,它在这种情况下有效,但是当我重定向到 http 时它不起作用
标签: php .htaccess redirect opencart