0

Followed instructions at (https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies) to install Drupal with Composer using the command:

"composer create-project drupal/recommended-project my_site_name_dir"

Composer download all the files and displayed that Drupal was ready to install. However, when trying go to the page in a browser get "Forbidden You don't have permission to access / on this server. "

Looking in the "my_site_name_dir" there is no .htaccess file so the server doesn't know to go into the "/web" subdirectory. The "my_site_name_dir" directory has only the following files: /Vendor /web .editorconfig .gitattributes composer.json composer.lock

Should the .htaccess file be created automatically by Composer? I thought Composer used to do this in earlier installations. Is there a recommended .htaccess template to use. Thanks.

Environment: Windows 10, PHP Version 7.1.20, Apache 2.4

  • Is there a recommended .htaccess template to use download the zip file and grab it from there. – No Sssweat Mar 8 at 4:24
  • Welcome to Drupal Answers! 👋 The .htaccess is created inside my_site_name_dir/web and you should point your vhost to my_site_name_dir/web of course. – leymannx Mar 8 at 11:42
0

Both drupal-composer/drupal-project and drupal/recommended-project create Drupal installations with a relocated DOCROOT, or web root. So, the .htaccess folder isn't in the root of the installation.

You need to point Apache to the 'web' directory, which is where the .htaccess and index.php files are. This is done at the Apache config level, not .htaccess level.

For example, on one of my servers, I have my git checkout in /var/www/prod. The config looks like

DocumentRoot /var/www/prod/web
<Directory /var/www/prod/web>
  AllowOverride All
  Options -Indexes
  Options +FollowSymLinks
  Require all granted
</Directory>
| improve this answer | |

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.