Posts Tagged ‘apache’
Apache Rewrites
Wednesday, March 25th, 2009
As many of you will know, the preferred web server for coding in php is called apache. Apache is by far the most popular web server software around, and dominates the web server market place, even though its free
!
One of the projects I’m currently working on for Students Work has required me to delve into the world of URL rewrites, which has forced me to look under the hood of apache (all be it only slightly). Now I do have some limited experience in dealing with apache, as I have my own web server set up at home, for a number of personal projects I have as well as a q&a server. So the task of editing httpd.conf files and creating .htaccess files didn’t seem like to much hard work.
So on Monday morning after a brief discussion with James about the direction he saw the project going, I set about creating the rules for the URL rewrites. Now it may be worth mentioning that RegeX is by far my least favourite scripting language, and I positively suck at writing it. I think I must have missed that lecture or been hung-over, one of the two. So I was instantly worried when I looked at the 1st google result contained lengthy and daunting amount of regex, so I quickly closed that page, and searched for the ‘beginners guide’.
Which brought up this fantastically simple, yet complete, easy to follow and very informative guide. The site uses very simple examples to explain the principles of the rewrite, and provides an easy to follow workflow from start to finish.
The end result now means that instead of the search URL having a value:
“/results.php?title=part%20%time&submit=Search”
We get a value:
“/search/part time”
As you can see the new value of the URL is much easier to read and interpret for the user.
Stew
Tags: .htaccess, apache, apache rewrites, server scripting
Posted in Uncategorized | 1 Comment »