Rewrite Tips - 301 Moved Permanently Redirect for Apache Web Server
1. How to Use 301 Redirect Sub-Domain to Domain for Apache Web Server
For those of you utilizing an mod_rewrite for URI rewriting, here is a quick tip
on setting up a 301 Moved Permanently
rule for http://example.com/ to http://www.example.com/.
RewriteCond Host: ^example\.com
RewriteRule (.*) http\://www\.example\.com$1 [I,RP]
Just drop the above rule into your local configuration file (e.g. httpd.conf)
No longer do you need to get your hosting provider involved when setting up 301 Moved Permanently redirects.
Be sure to always check your Server Headers to verify that the correct HTTP Status Codes are being returned.
|