OpenCart .htaccess 301 重定向
使用 OpenCart 如何使用 301 重定向将 www.
添加到域
.htaccess
内容:
#Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
#OPENCART REWRITES START
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#OPENCART REWRITES END
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www\.mysite\.com/$1 [R=301,L]
</IfModule>
请注意,302 重定向正在运行
Using OpenCart how would I use a 301 redirect to add www.
to the domain
.htaccess
content:
#Options +FollowSymlinks
<IfModule mod_rewrite.c>
RewriteEngine On
#OPENCART REWRITES START
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#OPENCART REWRITES END
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www\.mysite\.com/$1 [R=301,L]
</IfModule>
Note that 302 redirects are working
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您想要做的就是在 Apache 配置文件中执行此操作。
I think all that you are wanting to do is this inside of your Apache config file.
我这样使用:
I use like this:
试试这个代码。我将其保留为非 www 到 www 的标准,并强制 https 两者。无需进一步更改。
Try this code. I am keeping this as standard for non-www to www and force https both. No further change required.