How to detect root folder in URI when using apache mod_alias and mod_rewrite?
I have an website running on a sub folder in of the document root for example /var/www/this/an/other/dir in this folder I have a .ht_access file with mod_rewrite rules to redirect everything to index.php
# Do nothing if the file (s), link (l) or (d) exists
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Redirect everything else to index.php
RewriteRule ^.*$ index.php [E=PORT:%{SERVER_PORT},NC,L]`
I also have set up an alias for easy access
alias /foo /var/www/this/an/other/dir
Now when I go to the address http://host.com/foo/bar/ how can I detect that /foo is the root folder of my URI?