htaccess Elite

Hire htaccesselite professional

.htaccess tutorial


All times are UTC - 5 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Redirect non-www to www works, but Alias directive ignored
PostPosted: May 11th, '08, 10:38 

Joined: May 11th, '08, 10:30
Posts: 1
I'm currently redirecting all non-www traffic to the www version -- the RewriteRules below work fine. However, if I map a URL using the Alias directive (such as /images), I noticed that the rewrite rules take no effect; the /images URL is accessible with both the www and non-www version instead of redirecting to the www version. Here's my relevant Apache configuration:

Code:
<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  <Directory "/var/www/example/public">
    RewriteEngine on
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
  </Directory>

  Alias /images /var/www/images
</VirtualHost>


With the above code, all relevant URLs redirect properly to the www version, except when using the /images alias. So the /images alias is available from both of these URLs:

http://example.com/images/
http://www.example.com/images/

The non-www version does not redirect to the www version, but all other URLs and links redirect perfectly. Does anyone know how to fix this? I read about the PT flag but can't seem to get it to work in this context.

Thanks for the help!


Top
 Profile  
 
 Post subject: Re: Redirect non-www to www works, but Alias directive ignored
PostPosted: May 14th, '08, 23:06 

Joined: Oct 30th, '06, 13:55
Posts: 89
Geez that is one I haven't seen before, I don't have a clue.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB