mod_rewrite question - How to avoid Apache's 301 redirect to add trailing slash?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux