Posts Tagged ‘mod_rewrite’

Mapping content over domains with Apache

Using ‘Dynamic Mirror‘ in Apache you can map content from one domain to another. This was useful for a customer who had two very old domains from 1993 and built-up a nice SEO ranking.

We have two domains a-domain.com and b-example.com. The last one has a new design and some different links and is an application built in CakePHP. 
The other domain ‘a-domain.com’ had its purpose to serve the same content. (more…)

Checking query string with mod rewrite

The latest project I had to rewrite old URLs to new URLs. These URLs have been on the internet since 1994 so for the search engines and ranking on those pages it was very important.
Many URLs had to be detected through there query string, their GET arguments. Here is an example:
(more…)

Sending url parameter through _GET and Cake convention

Yesterday I tried to pass an ‘url’ GET parameter to cake but I got a ‘Http controller missing‘ error. Here is the url:
http://www.example.com/images/notify?myid=456&time=782638762863&url=http%3A%2F%2Fwww.cakephp.org
After a while I remembered that CakePHP uses the ‘url’ parameter when using mod_rewrite:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

This means that every request after the domain name is added to the url parameter. F.e.:
http://www.example.com/items/view/1234 will be transformed to http://www.example.com/index.php?url=items/view/1234. This means we cannot use the ‘url’ parameter ourselfs. (more…)