[英]Slim Framework : redirect to www. in .htaccess
I'm using Slim Framework on my website and I would like to avoid duplicate content by redirecting everything to "www." 我在网站上使用的是Slim Framework,我想通过将所有内容都重定向到“ www”来避免重复的内容。 but I don't know what to modify in .htaccess to do that.
但我不知道要在.htaccess中进行哪些修改。
The original .htaccess for Slim Framework is : Slim Framework的原始.htaccess是:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
Thank you 谢谢
Try: 尝试:
RewriteEngine On
#non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www%{HTTP_HOST}%{REQUEST_URI} [NC,L,R]
#end of non-www to www rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.