In order to redirect my www.site.com
to non-www
, I employed this bit of code found somewhere on the web.
RewriteCond %{HTTP_HOST} ^www.website.com [NC]
RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]
Although the site redirects fine, I get the "syntax not understood" warning in Google Webmaster Tools under:
webmaster tools-> Crawl-> Blocked URLs->robots.txt analysis
Google Webmaster Tools detects the sitemap just fine. I guess not much is wrong because of this, but is there a way to correct this, as I am getting errors like below:
Line 20: RewriteCond %{HTTP_HOST} ^www.website.com [NC] Syntax not understood
Line 21: RewriteRule ^(.*)$ http://website.com/$1 [L,R=301] Syntax not understood
This is how it displays when I visit the robots.txt directly.
User-agent: *
Disallow: /cgi-bin/
Disallow: /jwp/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
Disallow: /trackback/
Disallow: /feed/
Disallow: /comments/
Disallow: /category/*/*
Disallow: */trackback/
Disallow: */feed/
Disallow: */comments/
Disallow: /*?
# REDIRECTING WWW. TO NON-WWW
RewriteCond %{HTTP_HOST} ^www.website.com [NC]
RewriteRule ^(.*)$ http://website.com/$1 [L,R=301]
Sitemap: http://website.com/sitemap_index.xml