1

My company's website is on Drupal. Let's say the website domain is blue.com

We just acquired another company "Acme" and their website is on Wordpress, and it HAS to stay on Wordpress.

-We need "blue.com/acme" to show Acme's Wordpress website (which will be on a separate hosting environment) (Company leadership does NOT want to use a subdomain, it has to be a subdirectory URL structure.)

-while "blue.com" continues to pull up the Drupal site.

I've looked into split-hosting and reverse proxies but not sure...

2
  • 1
    If it's going to be on separate hosting it really should be a sub domain. Reverse proxies between completely separate hosting is dirt slow which will hurt usability and SEO. Mar 1 at 2:47
  • I agree with Stephen, you don't want that headache. Mar 2 at 17:10

2 Answers 2

2

Since you mention they are on separate servers / hosting environment, follow the next steps:

  1. Create a new subdomain acme.blue.com
  2. Edit your Apache configuration on the main domain's server (blue.com).

Add the following code:

ProxyPass "/acme"  "https://acme.blue.com/"
ProxyPassReverse "/acme"  "https://acme.blue.com/"

You can find a little more information on the Apache manual if you want to dig deeper on what else you can do, for example, add load-balancing.

2

I would put both sites on one server and install WordPress in a subdirectory inside of /var/www/html/. I do this sort of thing for international/multilingual sites all of the time.

Drupal gets installed here

/var/www/html/

WordPress gets installed here

/var/www/html/blue/

Example Nginx Config

Feel free to adjust as needed, or if I made a mistake. I didn't see any server-specific requirements included in your question. Apache would look different, I don't use it.

server {
    listen 80;
    server_name blue.com;
    return 301 https://$server_name$request_uri; # Redirect all HTTP traffic to HTTPS
}

server {
    listen 443 ssl http2;
    server_name blue.com;

    ssl_certificate /etc/nginx/ssl/blue.com.crt; # Path to SSL certificate, adjusted to match server_name
    ssl_certificate_key /etc/nginx/ssl/blue.com.key; # Path to SSL certificate key, adjusted to match server_name
    ssl_protocols TLSv1.2 TLSv1.3; # Recommended TLS protocols
    ssl_ciphers HIGH:!aNULL:!MD5; # Recommended cipher suite
    ssl_prefer_server_ciphers on;

    # Root for Drupal Installation
    root /var/www/html/;

    # Main Drupal site configuration
    location / {
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$query_string;

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }

    # WordPress Installation in /acme/
    location ^~ /acme/ {
        alias /var/www/html/acme/;
        index index.php index.html index.htm;
        try_files $uri $uri/ /acme/index.php?$args;

        location ~ ^/acme/(.*\.php)$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include fastcgi_params;
        }
    }
}

This will result in the subdirectory URL structure that your company's leadership desires, and be easy for you to manage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.