If you don’t have access to your host configuration
DocumentRoot
can only be used in server and virtual host configs, .htaccess it must be.
-
Let’s add directives in your .htaccess
RewriteEngine on
-
I assume you want to let the requests to /assets go through
#if a match for asset is found, do nothing RewriteRule ^assets/ - [L]
-
If a request tries to access
/php/views/pages/
directly, redirect it to its canonical versionRewriteCond %{THE_REQUEST} php/views/pages/ RewriteRule ^php/views/pages/(.*) http://mydomain.com/$1 [R=301,L]
-
And add a rule to map everything else to
/php/views/pages/
RewriteCond %{REQUEST_URI} !php/views/pages/ RewriteRule ^(.*)$ /php/views/pages/$1 [L]
If you have access to your host configuration
Forget about .htaccess files and use it. A sample configuration could look like
# ~base stands for your original DocumentRoot
<VirtualHost *:80>
DocumentRoot ~base/php/views/pages
Alias /assets ~base/assets
# other configuration parameters
</VirtualHost>