-4

I have a Drupal 8 site installed in a root directory(/var/www/html). Then I installed another drupal 8 site in another folder(/var/www/html/myFolder).

The homepage is working fine. If I try to login then first drupal 8 server giving 404 error.

Is there is any way to solve this issue. I couldn't even login to new site.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Clive May 18 '18 at 13:54
2
+25

As said previously, check your HTACCESS on both sites, and your apache virtual host. In theory, you can imbricate websites... But it's not recommended and easily maintainable.

But the simpler and far more recommended will be to reorganise your sites : If you want to keep 2 Drupal separately :

  • /var/www/html/SiteNAME1
  • /var/www/html/SiteNAME2

If you can have a multi site, you can check https://www.drupal.org/docs/8/multisite

1

First of all: You might want to check the logs: both sites logs + server logs + db logs. There got to be some error code somewhere.

Here's a list of things you can try:

  • Use different admin users for both sites
  • Check the redirect rules in your htaccess. Especially the www redirect, maybe there is something wrong in your declaration that can confuse the redirection
  • Make sure the 2 sites have clearly 2 differents domain declaration in your vhost, and that both declarations are pointing to the right folder
  • Make sure your directory declaration for each site contains the full path (<Directory /var/www/html/site1>), here is an example:
    <Directory /var/www/html/site1> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>

  • Make also sure you have nicely declared your bind zone (zone declaration in named.conf.local and creation of your db.domain.com). If one of them is a subdomain, hopefully you should have made a subdomain declaration in the main domain.

  • And check again your settings, especially the base_url and trusted host patterns, that can help too.

For each drupal change, clear the caches of the site that was edited, and eventually the second just for peace of mind. For every change made on the web server configuration (vhost), restart it (apache2/nginx). For each change in your bind zone, restart the bind service, and the webserver for peace of mind.

As you can see there might be quite a few sources to your issue. You may want to make more comparing tests of use cases what happens to one site if I trigger this in the second and vice versa. Hope this can help.

1

Check both site's .htaccess files and find the lines where it says RewriteBase etc.

Your first site's .htaccess needs:

  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  RewriteBase /

And your seconds site's .htaccess needs:

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  RewriteBase /myFolder

Apart from that your vhost file should have the following directives included.

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com *.example.com

    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        Options -Indexes
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/example_com_error.log
    LogLevel warn
    CustomLog /var/log/apache2/example_com_access.log combined
</VirtualHost>
  • Sorry, Not working. I changed the RewriteBase on both .htaccess. – Sarath Kumar May 15 '18 at 8:46
  • I tried before as per the article. I created two separate .conf file for two sites and enabled then restarted apache. That was not working. Then I deleted that. – Sarath Kumar May 15 '18 at 8:52
  • I could share my apache default.conf file here – Sarath Kumar May 15 '18 at 8:53
  • I will delete everything from default.conf page and put above code. Then I will let you. whether its works or not. – Sarath Kumar May 15 '18 at 8:58
  • @SarathKumar - You only need one Apache conf as long as you don't want to access the second site from a different domain. And please use both Drupal's default .htaccess files. – leymannx May 20 '18 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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