Twitter follower   Facebook follower   YouTube follower
 
  
     

Please share posts you like!
 

Author Topic: Rediect using htaccess mod_rewrite on Apache  (Read 656 times)

Webhelpforums

  • Administrator
  • Hero Member
  • *****
  • Posts: 563
  • Karma: +6/-0
  • Shared between Microsys, WebHelpForums and helpers
    • View Profile
    • Webmaster and Website Help Forums
Rediect using htaccess mod_rewrite on Apache
« on: April 27, 2010, 07:17:50 AM »
If you have multiple domains pointing to same site or just problems with with-www versus non-www URLs you can use this:


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} !^localhost [NC]
RewriteRule ^(.*) http://www.example.com/$1 [R=permanent,L]