I have the following code:
RewriteCond %{HTTP_HOST} ^m\.domain\.com?$
RewriteRule ^ http://domain.com/ipad%{REQUEST_URI} [L,P]
So my subdomain, http://m.domain.com is really pulling from http://domain.com/ipad/
Everything works fine if I type in: http://m.domain.com/shop-name/ it works perfectly. But when I leave out the trailing slash and type in http://m.domain.com/shop-name it redirects to http://domain.com/ipad/shop-name/ which shouldn’t happen, no one should see the ipad directory.
Does anyone know how I can fix this?
Thank you!
This might be because mod_dir is processing the request internally. When you access http://m.domain.com/shop-name and then it gets rewritten to http://domain.com/ipad/shop-name, mod_dir 302 redirects the browser to http://domain.com/ipad/shop-name/.
You can try handling the trailing slash in your RewriteRule. Probably a cleaner way of doing this, but something along the lines of:
EDIT: edited to address the 301 redirect of missing trailing slash