The .htaccess file can allow you to make a lot of important changes to websites hosted on Linux servers. One of the most useful things you can do with this file is create 301 redirects. This comes in useful when you want to redirect a website visitor from the non-www version of a domain to the www version (ex: beyourownit.com vs. www.beyourownit.com).
Why is this important? Let’s say that a large number of bloggers are linking to your website. Half of them include the www in their links, while the other half do not. Every time someone links to your website, you get a small amount of “link juice.” In short, link juice entails the benefits of being linked to by popular sites with good page ranks. But if people link to two different paths to your site, the link juice will be split and you will not see as many benefits.
Enter your website’s actual url in place of “yourwebsite.com.” Save the file with a name that will help you remember what it is. Upload this file to your web server, and rename it “.htaccess.” Now, every time someone links to the non-www version of your domain, visitors will still be directed to the www version.
With just three lines of code, you can automatically redirect both www and non-www links to the same page. Open Notepad and type in the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourwebsite.com$ [NC]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [L,R=301]
Enter your website’s actual url in place of “yourwebsite.com.” Save the file with a name that will help you remember what it is. Upload this file to your web server, and rename it “.htaccess.” Now, every time someone links to the non-www version of your domain, visitors will still be directed to the www version.
For more website help, visit the computer support forums at Be Your Own IT, or check out our YouTube Channel. You can also e-mail Jeremy to have your PC questions answered.
Computer Repair Home Study Course
Yes! I would like Be Your Own IT's
Computer Repair Home Study Course (learn more)
Select the Version You'd Like:
How the order process works
- You will be transferred to a secure server at 1ShoppingCart (https://www.mcssl.com)
- You will be asked to fill out your payment information
- Your payment will be processed by the 1ShoppingCart secure server
- Your order will be done
- You will be transferred back to www.beyourownit.com
- You will be provided a login/password and a special download page where you can watch and download the course










