Check this other question out, How do I change the base URL?
and this issue on drupal.org, https://www.drupal.org/node/2753591
In summary, Drupal 8 as of right now detects where it is automatically. On D7 there used to be a base_url
option which could be used for this.
In Drupal 8 this option has been removed. You don't have to configure base_url to run your site. Drupal 8 can detect this without your help. If not, you should first check your webserver configuration.
.htaccess
approach – You can't do this using the .htaccess
. You'll end up with a redirect from drupal/
going to /
which will then request /drupal
and go back to /
and so forth. You'll end up with a redirect loop.
If you want to test it, add this to Drupal's .htaccess
(/drupal/.htaccess
):
RewriteCond %{REQUEST_URI} ^(/drupal)(/)(.*)
RewriteRule ^ %2%3 [L,R=301]
Options I see,
- Move the files from the
drupal
directory one directory up
- Point the virtualhost to the
drupal
directory.
A lot of people use docroot
or htdocs
for a similar setup. This allows for some files to be in the repo but outside the directory being served by the web server.
- Try out the patch from the second link. It needs to be community reviewed for acceptance, so that would actually be great.