How to Redirect non-www domain to www

If you want to redirect a non-www domain to a www domain to

Add the following lines to your .htaccess file

RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain\.com RewriteRule (.*)$1 [R=301,L]
Code language: JavaScript (javascript)

About Ricard Torres

Senior Front-end Software Engineer at Netcentric, from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

@ricard_dev @ricard_dev

📝 Blog 🎙 Podcast

Leave a Reply

Add <code> Some Code </code> if you need to.