So I got my htaccess file set up, it look like this:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# MAGIC
RewriteCond $1 !/$
RewriteCond $1 !\.
RewriteRule ^(.+)$ /$1/ [R=301,L]
# //MAGIC
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([a-z0-9][-a-z0-9]+)\.domain\.com
RewriteCond %{REQUEST_URI} !^/subdomains/
RewriteRule ^(.*)$ /subdomains/%1/$1 [P,NC,QSA]
I work quite fine, it nicely directs phpmyadmin.domain.com to phpmyadmin.domain.com/subdomains/phpmyadmin/
But I think it is quite ugly it shows that in the url. So I want it to redirect it silently so it still points to phpmyadmin.domain.com/subdomains/phpmyadmin/ but the client can only see phpmyadmin.domain.com
I've been looking around but I couldn't find anything that worked like I wanted it to work. Does anyone have an idea how to fix this?