[ home | files | links | topics | stickers | about ]



Todays Stats

Visitors: 141
Referrers: 12
User Agents: 52
Pages Served: 1454
 
Total Pages
Served:

4867361


Search


mod_rewrite: URL modification
programming : by Corey - October 2nd 2010, 07:22AM
programming
To say that there is extensive documentation on Apache and its various plugins, including mod_rewrite, is to grossly understate the term. Documentation is voluminous to the point of beginning to wonder if the various authors had a combined total of more than five dates with actual girls in the history of their lives.

Disgruntled, then, was I to discover that on the entirety of the Internet, there was no documentation surrounding what I needed to accomplish. I've since come to realize that this is likely due to the obscurity of the issue or the availability of other commonly known tools to accomplish the task I had before me.

That task: Rewriting and redirecting a URL from my local environment using Apache and mod_rewrite.

Without delving into specifics, I needed to take an HTTP request generated by a page viewed in my browser and direct that request to another location, including a change of domain.

Now, the more seasoned among you may resolve that the very purpose of mod_alias is to perform this task. However, just because I'm a glutton for punishment, in this particular case, I also need to change the value of a query string parameter in the URL having its domain changed. Gaze upon the domain of mod_rewrite, ye mighty, and despair.

While mod_alias is designed to handle the translation of domains, mod_rewrite is designed to handle that and query string parameters (as well as a bunch of other stuff that I have no idea about). Before we can start directing URLs to and fro, we must first setup Apache.

I'll not regale the reader with the riveting tale of that process as it is rather well (and usefully) documented. The mod_rewrite module must be included in httpd.conf and the Apache instance must be configured to run as 127.0.0.1 on port 80. Do be wary of configuring the server value as localhost because sometimes the value does not translate, especially in Windows.

Continue reading...

tags: Apache mod_rewrite URL modification redirection cake pie howto

( Comments : 1 | Full article )

 

-+- neodux blog -+-
Page generated for 54.198.108.19 in 0.02870 seconds.
rss 2.0 feed