I had some .htaccess lines that worked for transparently rewriting my www subdomain to a www subfolder. Now, since a server update, it doesn't work anymore.
Actually, it does still work, except for root without request (number 1 below), which gives a 404 now.
What's going on? Doesn't !^/www
include empty requests?
This is what I want and worked before:
- http://www.e-motiv.net -> subfolder: www
doesn't work anymore - http://www.e-motiv.net/anything -> subfolder: www/anything
- http://e-motiv.net/www/(anything) -> don't rewrite
These are my htaccess lines:
#### www -> folder /www (not possible via Control Panel)
RewriteCond %{HTTP_HOST} ^www\.e-motiv\.net$ [NC]
RewriteCond %{REQUEST_URI} !^/www
RewriteRule ^ /www%{REQUEST_URI} [L]
#RewriteRule ^(.*)$ /www/$1 [L] #Variant
#check https://stackoverflow.com/questions/9083514
DirectorySlash Off
#www dir only
RewriteCond %{DOCUMENT_ROOT}/$0 -d
RewriteRule ^www/(.+[^/])$ /$1/ [L]
#other dirs
RewriteCond %{DOCUMENT_ROOT}/$0 -d
RewriteRule ^(.+[^/])$ /$1/ [L]
####
EDIT: I discoverd if I add R in fourth line, it works again, except that everyone can see it now, which I don't want. I am wondering now if it's not related to the bug said in Internal URL rewrite no longer working after upgrading Apache to 2.4
EDIT: Third case rewritten from "http://e-motiv.net/www" to "http://e-motiv.net/www/" as it makes no sense without slash.
EDIT: ALthough there is a workaround below for my case, the best thing to do is update your apache! My hoster couldn't, so for those who are in the same situation, it's still meaningfull (and instructive).