Apache redirect to www


/ Published in: Apache
Save to your folder(s)

This snippet checks if mod_rewrite is enabled and redirects example.com/some_uri to www.example.com/some_uri


Copy this code and paste it in your HTML
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine on
  3. RewriteCond %{HTTP_HOST} ^example\.com
  4. RewriteRule ^(.*)$ http://www.example.com$1 [R=permanent,L]
  5. </IfModule>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.