Magento的HTTPS上的所有网站:网址重定向到主页重定向、网址、网站、主页

2023-09-02 20:32:18 作者:小怪兽爱上了奥特曼

我使用Magento的1.9.1和我有SSL的问题。

我想有HTTPS上的所有网站的所有页面。该网站托管在子文件夹/店/.

当我在HTTPS版本的设置基本URL(不安全的),它的工作原理,但我有一个问题:当我访问的网址是http它不重定向到https的那一页,但简单的重新定位版本为https网店主页版

因此​​,例如:

HTTP://www.site.ext/shop/category/ 重定向到< A HREF =HTTPS://www.site.ext/shop/相对=nofollow> HTTPS://www.site.ext/shop/

打开网页会跳转某一固定网页的排查方法

您能帮我吗?

这是对/店/ htaccess的:

  ###################################### ######
##注释这些行的CGI模式
##请务必指定正确的cgi php的二进制文件名
##它可能是/ cgi-bin目录/ PHP-CGI

#操作PHP5,CGI / cgi-bin目录/ PHP5,CGI
#AddHandler的PHP5,CGI的.php

############################################
## GoDaddy的特定选项

#选项-MultiViews

##,你可能还需要加入这行为php.ini
## cgi.fix_pathinfo = 1
##,如果它仍然无法正常工作,重命名php.ini中php5.ini

############################################
##这条线是具体的的1and1主机

    #AddType的X MAPP-PHP5的.php
    #AddHandler的X MAPP-PHP5的.php

############################################
##默认的索引文件

    的DirectoryIndex index.php文件

&LT; IfModule mod_php5.c&GT;

############################################
##调整内存限制

    php_value memory_limit的512M
    php_value max_execution_time仅仅18000

############################################
##禁用魔术引号PHP请求瓦尔

    的php_flag magic_quotes_gpc的关

############################################
##禁用自动会话启动
##自动加载之前初始化

    的php_flag session.auto_start关闭

############################################
##让产生的HTML COM pression

    #php_flag zlib.output_com pression上

###########################################
#禁止用户代理验证,不破多图片上传

    的php_flag suhosin.session.cryptua关闭

###########################################
#关闭与PHP4的兼容性在与对象打交道

    的php_flag zend.ze1_compatibility_mode关闭

&LT; / IfModule&GT;

&LT; IfModule mod_security.c&GT;
###########################################
#禁止后处理,以不破多图片上传

    SecFilterEngine关闭
    SecFilterScanPOST关闭
&LT; / IfModule&GT;

&LT; IfModule mod_deflate.c&GT;

############################################
##使阿帕奇提供文件COM pression
## http://developer.yahoo.com/performance/rules.html#gzip

    #将过滤器上的所有内容
    ### SetOutputFilter DEFLATE
    所选内容类型#将过滤器只
    #AddOutputFilterByType DEFLATE text / html的文本/纯文本/ XML文本/ CSS文/ JavaScript的

    #Netscape 4.x版本有一些问题...
    #BrowserMatch ^的Mozilla / 4 GZIP只-text / html的

    #网景4.06-4.08有一些更多的问题
    #BrowserMatch ^的Mozilla / 4  .0 [678]无GZIP

    #MSIE伪装成Netscape的,但它是精细
    #BrowserMatch  bMSIE!没有GZIP!GZIP只-text / html的

    #不要COM preSS图片
    #SetEnvIfNoCase REQUEST_URI 。(?: GIF |?JPE G | PNG)$无gzip的不要,各不相同

    #请确保代理不提供错误的内容
    的#header追加的Vary的用户代理包膜=!不,变化

&LT; / IfModule&GT;

&LT; IfModule mod_ssl.c&GT;

############################################
##进行HTTPS ENV瓦尔可用于CGI模式

    SSLOptions StdEnvVars

&LT; / IfModule&GT;

&LT; IfModule mod_rewrite.c&GT;

############################################
##启用重写

    选项​​+的FollowSymLinks
    RewriteEngine叙述上

############################################
##,你可以把这里你的Magento的根文件夹
相对于Web根##路

    的RewriteBase /店/

############################################
##解决方法HTTP授权
##在CGI环境

    。重写规则*  -  [E = HTTP_AUTHORIZATION:%{HTTP:授权}]

############################################
##总是在这些文件夹丢失的文件发送404

    的RewriteCond%{REQUEST_URI} ^ /!(媒体|皮肤| JS)/

############################################
##从来不重写现有的文件,目录和链接

    的RewriteCond%{} REQUEST_FILENAME!-f
    的RewriteCond%{} REQUEST_FILENAME!-d
    的RewriteCond%{} REQUEST_FILENAME!-l

############################################
##改写一切的index.php

    重写规则。*的index.php [L]

&LT; / IfModule&GT;


############################################
##从服务器覆盖prevent字符编码问题
##如果你还有问题,可以使用第二行,而不是

    AddDefaultCharset关闭
    #AddDefaultCharset UTF-8

&LT; IfModule mod_expires.c&GT;

############################################
##添加默认Expires头
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault进入加1年

&LT; / IfModule&GT;

############################################
##在默认情况下允许所有访问

    订购允许,拒绝
    所有允许

############################################
##如果在集群环境中运行,取消该
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag无
AddHandler的应用程序/ x-的httpd-php54的.php .php5 .php4 .php3
 

解决方案

重写规则试试这个。* - [E = HTTP_AUTHORIZATION:%{HTTP:授权}]

 的RewriteCond%{} HTTPS关闭
重写规则^ $ HTTPS(*)://%{HTTP_HOST}%{REQUEST_URI} [L,R = 301]
 

I am using Magento 1.9.1 and I have a problem with SSL.

I would like to have https on all the website, all pages. The site is hosted on a subfolder /shop/.

When I set base url (unsecure) on https version it works but I have one problem: when I visit an url with http it doesn't redirect to https version of that page but simple redirects to https version of the shop homepage.

So for example:

http://www.site.ext/shop/category/ redirect to https://www.site.ext/shop/

Can you help me?

This is the htaccess on /shop/:

############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

#    Action php5-cgi /cgi-bin/php5-cgi
#    AddHandler php5-cgi .php

############################################
## GoDaddy specific options

#   Options -MultiViews

## you might also need to add this line to php.ini
##     cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

    #AddType x-mapp-php5 .php
    #AddHandler x-mapp-php5 .php

############################################
## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

############################################
## adjust memory limit

    php_value memory_limit 512M
    php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

    php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

    php_flag session.auto_start off

############################################
## enable resulting html compression

    #php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

    php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

    php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    ###SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

    # Netscape 4.x has some problems...
    #BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    #BrowserMatch ^Mozilla/4.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    #BrowserMatch bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    #SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    #Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

    SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

    RewriteBase /shop/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

    AddDefaultCharset Off
    #AddDefaultCharset UTF-8

<IfModule mod_expires.c>

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresDefault "access plus 1 year"

</IfModule>

############################################
## By default allow all access

    Order allow,deny
    Allow from all

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    #FileETag none
AddHandler application/x-httpd-php54 .php .php5 .php4 .php3

解决方案

try this after RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]