httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chengas123 <benjamin.j.mcc...@gmail.com>
Subject [users@httpd] mod_rewrite question - How to avoid Apache's 301 redirect to add trailing slash?
Date Wed, 27 Feb 2008 07:40:45 GMT

Hi,

I signed up for a hosting account that can support many domains.  One domain
is the root web folder and all the others are subdirectories in that folder. 
This gets confusing to maintain, so I’d like to move the main domain into a
sub directory too.

I’ve gotten pretty far using mod_rewrite:
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^(www\.)?lumidant\.com$
  RewriteRule ^(.*)$ /lumidant/$1
</IfModule>

However, I still have one bug left in this implementation, which shows up
when I request a directory without a trailing slash.  For example,
lumidant.com/contact becomes lumidant.com/lumidant/contact/ because Apache
does a 301 redirect to the actual file path to add the trailing slash.  Any
suggestions on how I would keep this URL as lumidant.com/contact/ in the
address bar?  I’m guessing I have to do a 301 to lumidant.com/contact/ in
mod rewrite before Apache does it to lumidant.com/lumidant/contact/, but I’m
not sure how to do this without also adding a trailing slash to files as
well.

Thanks,
Ben
Lumidant.com

-- 
View this message in context: http://www.nabble.com/mod_rewrite-question---How-to-avoid-Apache%27s-301-redirect-to-add-trailing-slash--tp15707662p15707662.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message