简体   繁体   English

在Joomla的URL上添加WWW,而无需重定向到索引

[英]Add WWW at Joomla's URL without redirect to index

I'm using Joomla and I need to add www in all url's from the website. 我正在使用Joomla,并且需要在网站的所有网址中添加www。

We have Facebook's Comments Plugin installed , and turns out when you access the website for example: www.mysite.com.br/category/k2-item-500 it shows some comments, but if you access the same page without 'www', the plugin shows different comments because urls are not the same. 我们已经安装了Facebook的评论插件 ,例如当您访问网站时显示为:www.mysite.com.br/category/k2-item-500它会显示一些评论,但是如果您访问的是同一页面而没有'www',插件显示不同的注释,因为网址不相同。

What I need is: 我需要的是:

When visitors access mywebsite.com/category/page The htaccess automatically add www into the URL. 当访问者访问mywebsite.com/category/page时htaccess会自动将www添加到URL中。

I've found some solutions but all them despite add WWW as well also redirect to index.php. 我找到了一些解决方案,但尽管添加了WWW,但所有解决方案也都重定向到index.php。

Thanks! 谢谢!

This should work as the first rule in your root .htaccess: 这应该是您的根.htaccess中的第一条规则:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM