Mysql 将非.www.htacces-magento上的www.https的规则重写为https

Mysql 将非.www.htacces-magento上的www.https的规则重写为https,mysql,linux,.htaccess,magento,redirect,Mysql,Linux,.htaccess,Magento,Redirect,我想重定向到我的网站。你能帮我把代码放在.htaccess文件上吗。该网站位于magento RewriteCond %{HTTP_HOST} !^www. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] 说明:如果请求的主机不以www开头,请将其重定向到以www开头源|参考: 上面的链接有一个默认的Magento htaccess文件,该文件已针对速度和SEO进行了优化,并具有将非www重写为www的代码,但是没有将HTTPS

我想重定向到我的网站。你能帮我把代码放在.htaccess文件上吗。该网站位于magento

RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
说明:如果请求的主机不以www开头,请将其重定向到以www开头

源|参考:

上面的链接有一个默认的Magento htaccess文件,该文件已针对速度和SEO进行了优化,并具有将非www重写为www的代码,但是没有将HTTPS/SSL非www重写为www的代码。因此,我从上面的链接/站点抓取了htaccess代码部分,并对下面的代码进行了额外的编辑,以便将HTTPS/SSL非www重写为www

##### Search Engine redirects and rewrites for SEO purposes #####

<IfModule mod_rewrite.c>
    # Rewrite|Redirect http to https|SSL & non-www to www
    RewriteCond %{HTTPS} !=on
    RewriteCond %{SERVER_PORT} ^80
    RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
    RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R,L]

    ##### Redirect away from /index.php and /home   
    ##### Warning: This index.php rewrite will prevent Magento 
    ##### Connect from working. Simply comment out the  
    ##### following two lines of code when using Connect.
    ##### Please note - https://www. if not using www simply use https://

    RewriteCond %{THE_REQUEST} ^.*/index.php
    RewriteRule ^(.*)index.php$ https://www.yourdomain.com/$1 [R=301,L]

    ##### Please note - https://www. if not using www simply use https://
    redirect 301 /home https://www.yourdomain.com

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L]
</IfModule>
#####搜索引擎出于SEO目的重定向和重写#####
#重写|将http重定向到https |将SSL和非www重定向到www
重写cond%{HTTPS}=在…上
重写cond%{SERVER_PORT}^80
RewriteCond%{HTTP_HOST}^yourdomain\.com$[NC]
重写规则(.*)https://www.%{HTTP_HOST}%{REQUEST_URI}[R,L]
#####从/index.php和/home重定向
#####警告:此index.php重写将阻止Magento
#####从工作中连接。简单地注释掉
#####使用Connect时,请执行以下两行代码。
#####请注意—https://www. 如果不使用www,只需使用https://
RewriteCond%{THE_REQUEST}^.*/index.php
重写规则^(.*)index.php$https://www.yourdomain.com/$1[R=301,L]
#####请注意—https://www. 如果不使用www,只需使用https://
重定向301/主页https://www.yourdomain.com
选项+FollowSymLinks
重新启动发动机
重写规则。*-[E=HTTP\U授权:%{HTTP:AUTHORIZATION}]
重写cond%{REQUEST_URI}^/(媒体|皮肤| js)/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-L
重写规则。*index.php[L]

由于堆栈溢出是一个问答网站,因此我投票将此问题作为离题题关闭,可能与此重复。你的问题不是关于编程。也许你应该把它贴在上面?谢谢,但我需要HTTPS的代码。。不使用www重定向到使用www