Jump to main navigation


Posts Tagged ‘mod_rewrite’

mod_rewrite changes url to lower-case in Windows

Using mod_rewrite to ensure canonical URL's in my CMS, I run across a strange behavior (bug?) of mod_rewrite. It seems that in Windows and under certain circumstances, it changes the case of the URL to lowercase. While this normally won't be a problem (Windows URL's are case insensitive) it can have undesirable effects if you need process the URL with PHP, for example. Read the full text...

Redirecting non-www to www with .htaccess

If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:

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

This will redirect any requests to http://my-domain.com to http://www.my-domain.com. There are several benefits from doing that: Read the full text...

Additional content and navigation

Categories

Recent comments