Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
apache:redirect-non-www-to-www [2014-08-05 18:13:20] – shaun.reitan | apache:redirect-non-www-to-www [2019-09-06 12:27:15] (current) – shaun.reitan | ||
---|---|---|---|
Line 3: | Line 3: | ||
This is an example using the mod_rewrite Apache module to force all traffic to your site to www.yourdomain.com. This can be useful in an SSL context, as well as for SEO purposes. Create a .htaccess file in your webroot (public_html for cPanel servers) and add the following lines: | This is an example using the mod_rewrite Apache module to force all traffic to your site to www.yourdomain.com. This can be useful in an SSL context, as well as for SEO purposes. Create a .htaccess file in your webroot (public_html for cPanel servers) and add the following lines: | ||
- | <sxh> | + | <code> |
+ | RewriteEngine On | ||
RewriteCond %{HTTP_HOST} ^your-domain.com | RewriteCond %{HTTP_HOST} ^your-domain.com | ||
RewriteRule (.*) http:// | RewriteRule (.*) http:// | ||
- | </sxh> | + | </code> |
- | + | ||
- | {{tag> | + |