MOD re-write function for Apache PHP Servers - SEO friendly URLs

Nick and James explain the benefits of using a .htaccess file and Mod Re-writes to generate SEO friendly URLs.

.htaccess code:

RewriteEngineOn

RewriteCond %{HTTP HOST}!^www.domain.co.uk$[NC]

RewriteRule^(.*)$http://www.domain.co.uk/$1[R,L]

Options+FollowSymLinks

RewriteCond %{THE REQUEST}^.*/index.php

RewriteRule^(.*)index.php$http://www.domain.co.uk/$1[R=301,L]

Other .htacess commands for Apache PHP servers:
http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html

Script:

Nick: Hi and welcome to our SEO video blog, we’re Nick and James from the Creare group.

To day we are going to go through the Mod Re-write function for Apache PHP servers and how to create SEO friendly URL’s.

James: So this is how you want your domain to display:

http://www.domain.co.uk/

There are variations that can get cached by the search engine bots for example:

http://domain.co.uk
http://www.domain.co.uk/index.php

Nick: So we do this to stop the search engines treating the same content as the 2 different pages. I have seen index pages and defaults pages that have picked up different PR (Page Ranks) to the root directory. This isn’t good practice and it also mean that any incoming links are re-directed back to the root directory.

James: So in order to use the Mod Re-Write settings, you need to ensure that your server has mod re-write enabled. We use one and one and fasthosts, both their re-seller packages and dedicated servers which are supported on their.

What you have to do to use the mod re-write settings is to create a .htaccess file, which is uploaded to the remote view.

Nick: There are 2 write conditions, the first re-directs back to www.domain.co.uk/ and the other re-directs away from /index.php.

I will show you a quick example of this now on Creare Communications. If we have a look at creare communications and remove the www. press enter we can see that it re-directs back to www.crearecommunications.co.uk and if we add index.php on the end it also re-directs back to the root.

James: Thanks Nick, the code that we used for that example is available on the blog post and can be copied and posted.

Related posts:

  1. How to make a search engine optimisation friendly .htaccess file A lot of sites can have duplicate content issues and especially CMS (Content Management Systems). I talked about the canonical link element on a previous post, which describes how to let Google know what page holds the original copy within your website. This post on how to build a search...
  2. RSS Aggregator (PHP) - Simple Pie Demo Video Downloads: simple-pie-example Script: Nick: Welcome SEO Video Blog – RSS Aggregators (PHP) My Top 3 and Simple Pie Tutorial. James: If you have a blog installed on your website, its good from both a usability and SEO point of view to have your latest news aggregating on your HP....
  3. 301 Redirects - Search Engine Optimisation Tutorial Scripts: Welcome - 301 redirects for search engine optimisation purposes. Matt Cutts recently released and video blog regarding the ability of merging 2 websites and how to correctly use 301 re-directs. The video can be seen at the bottom of this post. We have used 301 redirects in the...
  4. Canonical Link Element - Duplicate Content After coming across the canonical link element in February i hadn’t yet found a use for this tag / element. But now i believe i have. Basically it is designed to tell Google which page is the true version of potentially a wide range of domain combination or DB queries....
  5. SEO Friendly Website Tips A well structured web site is integral to any search engine optimisation campaign. This won’t give you guaranteed success, but will certainly help to overcome any technical problems as they arise. As the search engine algorithms constantly evolve more and more web site owners are losing their spots in the...

Tags: , , , , , ,

This entry was posted on Friday, July 10th, 2009 at 5:24 pm and is filed under SEO Videos. Both comments and pings are currently closed.

Comments are closed.

Welcome to Creare Communications SEO Blog, you will find tips, tricks and video tutorials all about SEO.

rss icon facebook icon linkedin icon twitter icon youtube icon

Monthly Archives