XCart 1.19.2.1 - 启用SSL

时间:2018-04-10 16:43:56

标签: .htaccess x-cart

有人可以帮我解决这个问题吗?

我们有一个运行1.19.2.1版本的XCart站点,我们希望强制所有流量进入HTTPS。已安装SSL证书,.htaccess文件如下所示:

DirectoryIndex home.php index.php index.html index.htm

# ErrorDocument 404 /404.php

# Show default error document for 404 errors caused by opening of image/media     files.
<Files ~ "\.(gif|jpe?g|png|js|css|swf|ico)$">
ErrorDocument 404 default

ErrorDocument 401 default

# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(ww+\.)?domain\.com 
RewriteRule ^(.*) http://www.domain.co.uk/$1 [R=301,L]

<IfModule mod_rewrite.c>
RewriteCond %{ENV:REDIRECT_STATUS} !^401$
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]


RewriteEngine on

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

我已尝试编辑该文件以将所有流量重定向到HTTPS,但我收到的重定向错误太多。

我尝试的一个示例是使用以下内容替换.htaccess文件的全部内容:

ErrorDocument 404 /index.php

RewriteEngine On
Options +FollowSymlinks
RewriteBase /

rewritecond %{http_host} ^domain.co.uk [nc]
rewriterule ^(.*)$ https://www.domain.co.uk/$1 [r=301,nc] 

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.domain.co.uk/$1 [R=301,L]


# RewriteRule ^([a-zA-Z0-9\-\%\s\_\.]+)(.htm)$  index.php?page=$1 [L]
##RewriteRule ^([a-zA-Z0-9\-\%\s\_\.]+)\.htm$   index.php?page=$1 [L]

DirectoryIndex index.php

#DirectoryIndex site_closed.html

RewriteEngine on

以上在另一个XCart网站上运行正常但不是这个。再次,我得到了太多重定向错误。

任何人都知道如何解决它?

亲切的问候

詹姆斯

1 个答案:

答案 0 :(得分:1)

我编辑了htaccess文件,但我没有编辑https.php文件,如下所述:https://help.x-cart.com/index.php?title=X-Cart:Configuring_HTTPS#Configure_the_HTTPS_server_in_X-Cart

现在全部工作。