Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
server-administration:redirect-non-www-to-www [2009-10-14 23:51:00] garrett.plasky |
server-administration:redirect-non-www-to-www [2009-10-14 23:53:09] garrett.plasky |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Redirect non-www Traffic to www Using mod_rewrite ====== | ====== Redirect non-www Traffic to www Using mod_rewrite ====== | ||
- | 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.yourodmain.com. This can be useful in an SSL context, as well as for SEO purposes. |
- | < | + | <q>%%RewriteEngine On |
RewriteCond %{HTTP_HOST} ^your-domain.com | RewriteCond %{HTTP_HOST} ^your-domain.com | ||
- | RewriteRule (.*) %%http:// | + | RewriteRule (.*) http:// |
{{tag> | {{tag> |