RSS Directory

This is the last in a three part htaccess tutorial. Feel free to review part 1 and part 2 before continuing.

In this tutorial, I will show you two final ways you can use htaccess on your website to make life a little easier for you.

Remove WWW

Why would you want to remove “www” from your domain name? Well, in terms of SEO, many search engines including Google will see “www.sitefever.com” as a different website than “sitefever.com”. Each would have its own PR ranking, and that’s not good.

You can test it out here on this website. Look in your address bar. There shouldn’t be any “www” in my domain name. Go ahead and try to type it in and see what happens. My htaccess file forces the removal of “www” so that all the statistics for sitefever.com don’t get split between “sitefever.com” and “www.sitefever.com”. Here’s how to do it:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yoursite.com$ [NC]
RewriteRule ^(.*)$ http://yoursite.com/$1 [R=301,L]

Obviously, you would want to change “yoursite.com” to whatever your domain name is.

Change Default Home Page

Have you ever wanted to display a special notice to all of your website visitors, such as an upcoming change to the website or any other important announcement? Well, what’s the first page a visitor sees when they type in your domain name in their browser? Your “index” page? Well, you can make it so that the first page a visitor sees is something like “announcement.html”, which would contain your important announcement. Keep in mind, your visitors will only see this page if they try to view the default index page of the directory. They can still type in another address or a specific page and bypass this altogether. Here’s the code:

DirectoryIndex announcement.html

Again, adding that line of code to your htaccess file will bypass your “index” page in a directory and display “announcement.html” instead. As always, you can change that page name to whatever you would like.

Conclusion

This would conclude the three part series onĀ .HTACCESS- Your New Best Friend. I hope that you gathered some information from these articles that you find helpful and will possibly implement on your own website.


Category: Tutorials
Article posted by: Neon on July 16th, 2007



Trackback URI | Comments RSS

1 Comment to “.HTACCESS- Your New Best Friend (Part 3)” »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> in your comment.

© 2017 SiteFever.com c/o Neon.