Skip to content

Running Drupal from a subfolder (URL to have this subfolder) #579

Description

@igorbiki

Context
Everything works as expected when Drupal is installed in /var/www/html. In this case base_path is "/". Which works.

What I want to do is, if I can make Drupal run from a subfolder of the root, so my URL is "docker.drupal.localhost:8000/mysub"

Tried modifying NGINX_SERVER_ROOT to point to "/var/www/html/mysub/web" but URL looks clean, no subfolder in the URL.

Next, I tried to send NGINX_SERVER_EXTRA_CONF_FILEPATH file with locations configuration (that failed due to my limited knowledge of how to configure nginx). The initial plan was simple, copy all the rules for location / and make it /mysub. Maybe I messed up rewrite rules (if ones are needed at all).

Then, I tried to modify traefik rules for nginx, using Path (and PathPrefix) instead of Host, but that failed as well.

Why would you need something like that?!
If base_path is not "/" in some cases links come prefixed with this base_path (happens on popular Drupal hosting platforms, not to name one here). And as a result, some links are broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions