Forum Moderators: phranque
Here's the .htaccess entry:
Options +FollowSymlinks
rewriteengine on
rewritecond %{HTTP_HOST} ^www.example.com$ [NC,OR]
rewritecond %{HTTP_HOST} ^example.com$ [NC]
rewriterule ^ http://www.example.com/m/ [R=301,L]
Any ideas what I'm doing wrong?
Much appreciated,
H
Fixing that and cleaning up some code redundancy gives:
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{REQUEST_URI} !^/m/
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^ http://www.example.com/m/ [R=301,L]
Alternatively, you may wish to create and use a back-reference to the requested URL-path, and simply prepend "/m" to it, so that it does not get discarded.
Also, I would question whether you really want to 'expose' the /m subdirectory to the client. A 'silent' internal server filepath rewrite might be more appropriate. Of course, this depends on details not posted and perhaps obscured by the 'example' domain names. :)
Jim
[edited by: jdMorgan at 3:01 am (utc) on Jan. 11, 2010]