3

I installed the Drupal website in this path:

/var/www/html/testdrupal.localhost/public_html/drupal/web

Below I show the virtual host configuration file testdrupal.localhost:

<Directory /var/www/html/testdrupal.localhost>
    Require all granted
</Directory>
<VirtualHost *:80>
    ServerName testdrupal.localhost
    ServerAlias www.testdrupal.localhost
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/testdrupal.localhost/public_html/drupal/web

    ErrorLog /var/www/html/testdrupal.localhost/logs/error.log
    CustomLog /var/www/html/testdrupal.localhost/logs/access.log combined

</VirtualHost>

When I access the url www.testdrupal.localhost I correctly see the start page of Drupal, but when I click on the login link, I get a 404 error.

The URL shown on the browser's address bar is:

http://www.testdrupal.localhost/drupal/web/user/login

I also verified that:

ThunderBird
  • 1,915
  • 13
  • 19
  • 31

2 Answers2

1

Might a bit old and you probably fixed this, but i'll post the answer so that it might help others.

 <VirtualHost *:80>
  DocumentRoot /var/www/html/my_project/docroot
  ServerName ${alias}
  ServerAlias ${alias}

  <Directory /var/www/html/my_project/docroot>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/error.log
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

${alias} = is the name you wrote in the hosts file, next to the IP address of localhost

lordZ3d
  • 121
  • 7
1

I was running into the same problem. After days of trial and error I found the solution.

I had to change the location of the index.php in the .htaccess file as it was mentioned in Drupal's advice

Old setting:

  # Pass all requests not referring directly to files in the filesystem to
  # index.php.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

New setting:

  # Pass all requests not referring directly to files in the filesystem to
  # index.php.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ /drupal/index.php [L]
user.dz
  • 47,137
  • 13
  • 140
  • 258