Take the 2-minute tour ×

Let's say I have the domain "example.com" which works both with and without the "www." prefix.

And let's say I have a folder thereon called "extra".

When someone visits www.example.com/extra I would expect Apache to redirect them to www.example.com/extra/. But no! Instead, they're sent to example.com/extra/. Losing the www. prefix means that (a) a new session is generated, and the user is signed out, and (b) the security certificate becomes invalid.

I'm using Apache on a shared hosting platform (hsphere).

.htaccess file is as follows:

ErrorDocument 500 "<h2>Application error</h2>Web application failed to start properly"

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php/$1
share|improve this question
could you show your configuration? are there any redirect rules? –  Christian Jan 6 '10 at 14:17
No redirect rules, only rewrites. I've added the .htaccess file above. –  TRiG Jan 6 '10 at 14:47
The rules you posted don't perform any redirection. Can you post your configs? At least the virtualhost definition. –  David Jan 6 '10 at 18:04
add comment

1 Answer

up vote 0 down vote accepted

I guess it is because of a UseCanonicalName directive in your Apache httpd configuration. Just set it to UseCanonical off or delete the directive.

share|improve this answer
Thanks. I'll try playing with that and see what happens. –  TRiG Jan 6 '10 at 14:48
add comment

Your Answer


