1

When installing drupal 8 with composer, the default installation moves to the subdirectory /web.

When visiting the root at http://example.com apache 2.3 serves a 403, but when visiting http://example.com/web and corresponding subpages everything works.

There are lots of guides about how to map this to root, that is more or less a question of setting the correct DocumentRoot. I'm using this virtual host:

<VirtualHost *:80>

  ServerName localhost
  DocumentRoot /var/www/html/web

  <Directory /var/www/html/web>
    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    Options FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

</VirtualHost>

However I want to add another fake subdirectory without changing the default file structure.

For example the path http://example.com/fakesubdir/admin/config should work as expected and http://example.com/admin/config along with http://example.com/ should throw 403's.

I've tried changing the DocumentRoot, adding Aliases and changing various rewrite rules, but all of these seem to try to point to where the files are placed on the host. I can't figure out how to just make an apparent change to the uri.

I've found a few guide that requires changing $base_url in settings.php, but this method seems to be deprecated in drupal 8.

I've also looked at this question, but the answers there suggests moving the files to another location which I don't want to do, since I want to keep the default /web directory created by composer to avoid a host of other problems.

How can I add this fake subdirectory?

kubanczyk
  • 13,812
  • 5
  • 41
  • 55
glaux
  • 671
  • 5
  • 7

0 Answers0