Coding of .htaccess for canonical issue & robots.txt for sitemap

bleggee used Ask the Experts™
Can someone check this please ... Is this the correct coding for robots.txt if I put a sitemap.xml file in the web root folder:
     User-agent: *
Is this the correct coding for .htaccess if I want to direct all requests to the Non-www https version of a URL:
     RewriteEngine On
     RewriteCond %{HTTP_HOST} ^www\.EXAMPLE\.com [NC]
     RewriteRule ^(.*)$$1 [L,R=301]
     RewriteCond %{SERVER_PORT} 80
     RewriteRule ^(.*)$$1 [L,R=301]
Any advice appreciated!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2004
Regarding canonical hostnames, Apache's guidance is available at and  While they recommend using multiple VirtualHost containers alongside a Redirect directive, I typically prefer the rewrite method.

Regarding SSL enforcement, the wiki again provides some guidance: and  In this case, I prefer the Redirect approach, since I typically enforce SSL across the entire site.  Without having to parse individual request names, a host-wide Redirect does the job.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial