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

MoodyW
  • 23
  • 5

2 Answers2

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

Videonauth
  • 33,045
  • 16
  • 104
  • 120
  • 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 08 '16 at 02: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 08 '16 at 03: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 08 '16 at 03: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 08 '16 at 03:09
  • I'm also assuming that moving the files to the main directory will give the same error? – MoodyW Jul 08 '16 at 03:12
  • Probably, i would set up the directory to begin with and then set up the forum software to make sure the paths are set correctly. Other way around you might always run into those issues and might have to refer to the mybb documentation how to set up and fix this. – Videonauth Jul 08 '16 at 03:15
  • Ugh..I'll probably just reinstall mybb forum as long as it is brand new.. Thanks for your time and help! – MoodyW Jul 08 '16 at 03:23
  • If my answer was helpful you might consider accepting it, so this question lingers around unanswered. – Videonauth Jul 08 '16 at 03:23
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.

MoodyW
  • 23
  • 5