Nomistake
Nomistake

Reputation: 863

Drupal root directory from development

I just put a drupal 8 site online. I developed this site in folder 'snew'. The online site refers to that folder and drupal expects the files to be in this sub folder. So everything refers to: www.domain.com/snew/ And it should be the root of the website: www.domain.com

How can i change this?

Upvotes: 1

Views: 888

Answers (1)

Shamsher Alam
Shamsher Alam

Reputation: 21

For most of my installs, I have Drupal running from subfolders. Here is what I do: settings.php Uncomment and modify this line:

# $base_url = 'http://www.example.com';  // NO trailing slash!

.htaccess (in your subfolder) Unless there are server/web host-specific items to add, this can be left alone

.htaccss (in Web root)

Options -Indexes

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} !^www\.[yourdomain]\.[your TLD]$ [NC]
RewriteRule .* http://www..[yourdomain].[your TLD]/ [L,R=301]
RewriteRule ^$ production/index.php [L]
RewriteCond %{DOCUMENT_ROOT}/[subfolder]%{REQUEST_URI} -f
RewriteRule .* [subfolder]/$0 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*[subfolder]/index.php?q=$0 [QSA]

Hope this helps.

Upvotes: 2

Related Questions