开发者

Require the www via mod_rewrite - additional conditions needed?

To rewrite example.com to www.example.com I was told to use the following rules within my root .htaccess file:

# Require the www
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteCond %{REQUEST_URI} !^/sitemap\.xml$
RewriteCond %{REQUEST_URI} !^/favicon\.ico$
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Could you please explain what's the matter 开发者_运维技巧with the first five lines here? Are they really needed/recommended? TIA


.htaccess tricks This article will help you to understand all the tricks about htaccess . Later yourself decide whether you need first five lines

Hope its helpful

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜