1

So my problem is that when I access www.my-website.com I land on the page related to var/www/html instead of my actual website directory var/www/html/mywebsite.

How can I change that please ? I'm using LAMP on Ubuntu 16.04 LTS.

Thank you in advance. EDIT: I'm using a MYBB forum, changing DocumentRoot is but a glitch in this case, as it does makes my landing page the right one, but it loses all php code and links / button links since they refer to www.my-website.com/landingpage which becomes inexistant after it became www.my-website.com

3
  • why not simply copy the contents of /var/www/html/mywebsite to /var/www/html ?
    – Videonauth
    Jul 8, 2016 at 2:38
  • 2
    Possible duplicate of How to move www directory to home? Jul 8, 2016 at 2:48
  • That 3 years old question did not solve my issue, thanks! Anyone knows how to use the htaccess method ? I'd like to try it
    – MoodyW
    Jul 8, 2016 at 3:01

2 Answers 2

1

This answer assumes you did not change the default settings of the apache server before.

First change the /etc/apache2/apache2.conf, edit the following lines:

<Directory /var/www/html/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

to

<Directory /var/www/html/mywebsite/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

then edit /etc/apache2/sites-available/000-default.conf and change the following line

DocumentRoot /var/www/html

to

DocumentRoot /var/www/html/mywebsite

Easier however would be to simply copy the contents of /var/www/html/mywebsite to /var/www/html

8
  • On a basic level it does work, but in my case it's not, as I installed a mybb forum and due to this change my forum lost the php codes and the button links and everything
    – MoodyW
    Jul 8, 2016 at 2:59
  • Then some other things in your whole installation are not right be it either the owner of the folder you access or the settings of the apache or php, a simple edit should not have the loss of anything as a result. As well you did not state that in your question and I answered based on the informations given.
    – Videonauth
    Jul 8, 2016 at 3:02
  • Simple, It made the landing page var/www/html/landingpage, so www.my-website.com/landingpage became www.my-website.com while all the links and buttons refer to a www.my-website.com/landingpage/../ which now became not found!
    – MoodyW
    Jul 8, 2016 at 3:08
  • yes you might need to edit the forums config files to fit the proper paths again. probably called setup.php or similar. As well check if there are links saved into the mysql database of the forum. This is the probable cause of the vanishing items.
    – Videonauth
    Jul 8, 2016 at 3:09
  • I'm also assuming that moving the files to the main directory will give the same error?
    – MoodyW
    Jul 8, 2016 at 3:12
0

Ok I found the answer:

1- Leave DocumentRoot pointing at /var/www/html

2- Move your mybb forum from /var/www/html/yourforum to /var/www/html

3- Open settings.php file vi /var/www/html/inc/settings.php

4- find $settings['bburl'] line and set it to your website new url:

$settings['bburl'] = "http://www.mywebsite.com/";

5-find $settings['cookiedomain'] and set it to this:

$settings['cookiedomain'] = ".mywebsite.com";

6- find $settings['cookiepath'] and set it to "" if your directory is var/www/html otherwise set it to "yourforum" if your directory is var/www/html/yourforum

$settings['cookiepath'] = "";

7- go to your mybb admin cPanel: Configuration>Setting>Site Details and change the settings to the same thing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .