I recently came across a curly issue hosting my Drupal website on my shared hosting provider. I wanted to now set up a Drupal website using the primary domain name I registered my account with. However, as with shared hosting accounts, the primary domain has a fixed directory where websites can be served from and cannot be virtually hosted/moved to some other part of the home directory structure.
The two issues I faced were:
- I wanted to install my primary domain in the same sub-directory structure as with my other add-on domains (instead of installing it in the root directory), and
- the URI address had to be shown as if it was virtually hosted (ie. not showing the path where the website is installed.)
The answer turned out to be a simple change to the .htaccess file in the directory serving my primary domain.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !websites/primarydrupal/
RewriteRule (.*) /websites/primarydrupal/$1 [L]
</IfModule>
Two problems that require further investigation
- If you had installed Drupal prior to implementing the .htaccess redirection, you will find that your admin and menu paths include the full install path in the URI. By reinstalling Drupal with the redirection in place, solves this issue. If there is an easier way (apart from reinstalling Drupal) that will rebuild the paths, I'd like to hear it.
- When I performed a Drupal upgrade via Composer (8.3.7 => 8.4.0), logged in and run Update.php, Drupal defaulted the URI path to the full installation path and failed. The workaround I found was to change "settings.php" and temporarily change the following line :
$settings['update_free_access'] = FALSE;
$settings['update_free_access'] = TRUE;
Leave your comments below.
About the author |
|
Tom Thorp is an IT Consultant living in Miami on Queensland's Gold Coast. With over 30+ years working in the IT industry, Tom's experience is a broad canvas. The IT services Tom provides to his clients, includes :
Website development and hosting
Database Administration Server Administration (Windows, Linux, Apple) PABX Hosting and Administration Helpdesk Support (end-user & technical). |
|
If you like any of my content, consider a donation via Crypto by clicking on one of the payment methods : |
External Links