Posted on 06-09-2007

Mod Re-Write on Apache is a great feature, great for SEO work and great to keep things tidy.

When planning a new website you should think about how search engines will crawl your site and just as importantly how people will.

Never overlook content for some google context.

11 Points to make Mod Re-Write work for your users and google

  1. Use directories to guide people - if the book ‘7 Habits of Highly effective people’ is one of your products make this obvious. “ www.bookshop.com/products/self-help-and-personal-growth/books/7-habits/ ” - maybe a bit long winded depending on the size of your operation - but is still better than ” www.bookshop.com/products/books/129/ “.
  2. Use it to trick RSS readers - One problem that people don’t realise (not enough testing) is that yes RSS feeds are great and your users will love them, but readers can point blank reject any that do not end in .xml . Keep them happy - add the .xml to the end even if your showing a php file that generates the feed ” www.bookshop.com/rss/new-products.xml
  3. Be careful for loops - Theoritically its possible to create a 1 page php script/.htaccess file that could create an almost infinite loop that google would follow for months before realising it - this problem can occur with bad linking and the use of regular expressions in your .htaccess. If your .htaccess is programmed to send anything after your domain to a php file, nothing will ever be shown as not available - great you might think - but not if bots or people get stuck in the loop!
  4. Learn it completly - Mod re-write is hugely under-used in my opinion - there are some great parts of it that can save you a lot of time with file creation and the way everything is processed. Learn it completely and utilise your knowledge to support a good php/asp/html/jadajada site
  5. Use real pages too - don’t make your site too perfect - use some real file extensions too e.g. ” www.bookshop.com/about-us.php “. Hiding all pages behind Mod re-writes could waste time that you could spend doing other more important web work - with the one off pages (about us, contact us etc.) don’t bother. ” www.bookshop.com/about-us/ ” looks neater but has no real gain other than its neatness.
  6. Combine it with a permalink script for maximum effect - With the right scripting your whole site can automatically create its urls on the fly, once set up you can have flashy keyword packed urls implemented by the adding of information. e.g. adding a new product ‘8th Habit book’ can be done, the url generated from the title so the link to the product is automatically set as ” www.bookshop.com/books/awesome/8th-habit-book/ ” - looks flash - helps pump googlage with keywords. (Note bookmark my homepage if you want a script that incorporates this and a lot more into an SEO CMS like system as I am currently sticking all these little bits I have developed over the years together!)
  7. Pay attention to CSS and links - Adding directories that are not there is great in theory - but kills a page if it uses CSS sheets stored elsewhere. CSS gets its position from the url and PHP from the root: for example a file in your domains root directory called ‘example.php‘ could be called to show “ www.bookshop.com/examples/one/ ” but if this page outputted html that linked to a css file in the same directory it would load without a style sheet - because it would be looking for a style sheet in the directory ” examples/one/ ” - note links also wont work because of this principle. I have developed an easy get round for this that allows you to go as many directories deep as you want while maintaining all your links and CSS in the original directory. I will be releasing this within the next fortnight or so as part of a collection of SEO tools. (Bookmark www.criTix.co.uk - it’ll be worth it I promise!)
  8. Stroppy Mod re-write - I have occasionally managed to piss mod re-write off, primarily it will just return 500 internal errors if you use short phrases or things like ‘directory’ in mod re-write. Just test the thing - good thing is if it doesn’t work - no pages will probably work - so it’ll be obvious!
  9. Don’t overcomplicate your Mod re-write - Even though alot of the above points may indicate complicated or long winded .htaccess files - its best to keep it as efficient as possible (as with most things.) Huge htaccess files can be a burden and difficult to maintain - try to plan and maintain a good mixture of htaccess and inscript dynamics in the most code efficient way - no one likes a slow loader!
  10. Actively use Modrewrite - The uses are endless - I have used it to show ‘maintainance’ pages while I work on parts of the site (you can temporarily divert all traffic to a folder to a certain file while you fix errors or such!), redirect badly spelt guesses at urls and consistently use it to hide the types of files I am using. Just remember modrewrite whenever you are planning site development - it will save you time!
  11. HTACCESS is your friend - Like all good config files the best bit is you could have 10 files that do different things - that can be switched in an instance. Try one version of your htaccess out for a few months, keep a ‘maintenance’ version on the server and then just switch it when you are performing maintenance ( a quick hint: if you have 2+ .htaccess files on the server name them: .htaccess (the active one), a.htaccess, aa.htaccess etc.) this way they will always appear next to the active htaccess so you can simply rename the files to switch them around! )

This is part of a series of posts I am writing to develop further a concept of site development. I will detail all parts of website development, progression with times - seo age etc. I will also be releasing a bolt on SEO toolkit which will have a load of php,mysql,htaccess etc examples and a little SEO Content Management system that I use on every website I maintain!

    Read More   
Post a Comment
Name:
Email:
Website:
Comments:
    • e-business, SEO, Internet Theory and a little Coding...


  • Blogroll