mysql - 在 .htacces magento 上将 non.www 的规则重写为 https 到 www.https

标签 mysql linux .htaccess magento redirect

我想重定向 https://example.comhttps://www.example.com对于我的网站。你能帮我把代码放在 .htaccess 文件上吗?该网站在 magento 中。

最佳答案

RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

解释:如果请求的主机不是以www.开头,则重定向到以www开头

关于mysql - 在 .htacces magento 上将 non.www 的规则重写为 https 到 www.https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36336512/

相关文章:

eclipse - 如何在 Eclipse 中突出显示 .htaccess 文件

php - 通过 .htaccess 更改根文件夹

php - 在 PHP while 循环中获取变量值的总和

PHP MySQL : remember previous RAND()

python - 在 python shell 中执行 bash 的复杂查找命令

linux - 如何使用shell脚本删除文本文件中具有相同单词且数字连续增加的字符串?

PHP 在列名称中使用连字符获取 pdo

php - 按条件获取 SQL 行

python - 在 64 位 linux 上编译 32 位 python 模块(例如 numpy)

php - 未指定输入文件