i want to put in my htaccess file a redirect from non www inquiries to www. for my website.. for example, redirect all domain.com to www.domain.com i have coding that will do that but there is already existing coding in my htaccess that i don't want to mess up. coding for zen cart?? and for ceon_uri_mapping.. here is the coding already in there: ## BEGIN CEON URI MAPPING REWRITE RULE RewriteEngine On # Don't rewrite any URIs ending with a file extension (ending with .[xxxxx]) RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,5}$ [OR] RewriteCond %{REQUEST_URI} \.(html)$ [NC] # Don't rewrite any URIs for some, popular specific file format extensions, # which are not covered by main file extension condition above RewriteCond %{REQUEST_URI} !\.(mp3|mp4|h264)$ [NC] # Don't rewrite any URIs for some specific file format extensions, # which are not covered by main file extension condition above # Uncomment the following line to apply this condition! (Remove the # at the start of the next line) #RewriteCond %{REQUEST_URI} !\.(3gp|3g2|h261|h263|mj2|mjp2|mp4v|mpg4|m1v|m2v|m4u|f4v|m4v|3dml)$ [NC] # Don't rewrite admin directory RewriteCond %{REQUEST_URI} !^/adminhiddenxxxxxx [NC] # Don't rewrite editors directory RewriteCond %{REQUEST_URI} !^/editors/ [NC] # Don't rewrite logs directory RewriteCond %{REQUEST_URI} !^/logs/ [NC] # Don't rewrite catalog directory RewriteCond %{REQUEST_URI} !^/catalog/ [NC] # Don't rewrite tempEP directory RewriteCond %{REQUEST_URI} !^/tempEP/ [NC] # Don't rewrite mobile RewriteCond %{REQUEST_URI} !^/m/ [NC] # Handle all other URIs using Zen Cart (its index.php) RewriteRule .* index.php [QSA,L] ## END CEON URI MAPPING REWRITE RULE since i know VERY LITTLE about htaccess coding, can someone please help me here.. btw, the admin directory is of course not real..
Quite a simple request, Add this under "RewriteEngine On" RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Code (markup):
What D3Tek posted is exactly right, and no, it will not affect subsequent rewrites. The REQUEST_URI is independent of the HTTP_HOST.
why in the world was this flagged as being in the wrong category??? sometimes the geek moderators in here have to chill out a bit and realize we don't all speak geek.. to me this was a programming issue.. how in the world was i supposed to know it had to do with Apache??