Tag Archives: Apache

Apache: Redirect one domain to another

The following .htaccess redirects all traffic to a different domain and preserves the path.

RewriteEngine On
RewriteRule (.*) http://example.com/$1 [R=301,L]

The following redirects non-www to www version, also preserving the path.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

And hopefully I’ll remember I put this here the next time I’ve forgotten how to do this…

PHP: One way of differing between DEV and PROD environments with Kohana

Usually when I develop websites, they will be deployed to a domain, for example www.geekality.net. But when I develop this site locally, I usually want it to be in some sub-folder of localhost, since I usually have more than one website going on, and I don’t want the trouble with virtual-hosts. So, to solve this for my Kohana websites I do the following simple thing. This technique would work for other websites programmed in PHP as well, but the PHP part would probably be a bit different.

Continue reading PHP: One way of differing between DEV and PROD environments with Kohana