Step 1: Upload all of your files to your web server.
The first thing I did wrong when I was deploying my first Drupal 8 website was only upload the /web directory. Big mistake! You need to make sure you upload ALL of the project folders, including /vendor, /web, etc.
Step 2: Update your .htaccess file
We need to update the main .htaccess file to tell the web server that our main website files are in the /web directory:
RewriteEngine on
# Redirect to the subdirectory because that's where Drupal is installed
RewriteRule (.*) web/$1 [L]
Step 3: Add the following PHP snippet to your settings.php file
The .htaccess adjustment above does most of the work, but as per this article I found, we also need to add the following snippet to the settings.php file:
if ( isset($GLOBALS['request']) && '/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME') ) {
$GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}You're all set!
You should now have a fully functioning Drupal 8 website on your web server.
Category
Add new comment