使用opencart中的htaccess将https重定向到http


Redirect https to http using htaccess in opencart

我已经安装了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的文本文档。

提前谢谢。

最后一个;)

你可以尝试把这个代码,更改为你的域

在config.php和admin/config.php文件中,将引用更改为https,替换为"http"。

define('HTTPS_SERVER', 'http S://www.example.com/');
define('HTTPS_IMAGE', 'http S://www.example.com/image/');

更换

define('HTTPS_SERVER', 'http://www.example.com/');
define('HTTPS_IMAGE', 'http://www.example.com/image/');

我的htaccess文件:

Options +FollowSymlinks
# Prevent Directoy listing 
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)(('.tpl|'.ini|'.log|(?<!robots)'.txt))">
 Order deny,allow
 Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourDomain.com
RewriteRule ^ http://yourDomain.com%{REQUEST_URI} [L,R=301]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]

问候,

这就是解决方案:

 RewriteCond %{HTTP_HOST} ^yourDomain.com
 RewriteRule ^ http://www.yourDomain.com%{REQUEST_URI} [L,R=301]

或者,如果你喜欢不使用www,

 RewriteCond %{HTTP_HOST} ^yourDomain.com
 RewriteRule ^ http://yourDomain.com%{REQUEST_URI} [L,R=301]

并且,在管理面板中:

系统->设置->服务器->ssl=无

问候,

是的,好的我以为你的访问是"正确的"。请制作以下内容:

创建一个新文件.htaccess或将htaccess.txt重命名为.htaccess.文件名中的"点"很重要。".htaccess"(我建议您重命名该文件)

把那个文件放在第一位上的重写引擎

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^yourDomain.com
RewriteRule ^ http://www.yourDomain.com%{REQUEST_URI} [L,R=301]

或者,如果你喜欢不使用www,

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^yourDomain.com
 RewriteRule ^ http://yourDomain.com%{REQUEST_URI} [L,R=301]

并且,在管理面板中:

系统->设置->服务器->ssl=NO系统->设置->服务器->Url SEO->YES

请重试:)问候,

将此代码添加到.htaccess文件中,它应该重定向到配置文件中的内容。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>