Url rewriting with .htaccess updated for 2010

Last week I uploaded the newest version of my website, and promptly ran into a problem I didn't understand. Had I been able to find this solution through the searches I initiated, I would have saved myself both some time and some undeserved annoyance with my webhost. 

My site uses .htaccess redirects to make the url's clean and predictable, as well as transferable from previous versions. In the past, the redirects were done using the following:

RewriteRule ^home/$ http://timothycomeau.com/?page=home

That is 'home' is an alias for the full url that follows. 

This didn't work with my new host; rather, inputing 'timothycomeau.com/home' rewrote the url as the full url I was trying to hide (http://timothycomeau.com/?page=home). With the help of my host's tech support, I was told that the use of the full url was the problem. Rather, I needed to write my RewriteRules this way:

RewriteRule ^home/$ /?page=home. 

When I did this, the url's behaved as I expected and wanted them too.

Posted via email from Timothy’s posterous

Leave a Reply

Your email address will not be published. Required fields are marked *