Have you ever installed LAMPP or XAMPP for Linux? I went to other Linux or Xampp forum and found that there are many question regarding to
How to change the default page for XAMPP?
Scenario 1 – Someone just want to change default page for localhost. Doesn’t matter where the file location is, as long as the default localhost page is not the XAMPP page as shown below:
File Location: /opt/lampp/htdocs/index.php
File Location: /opt/lampp/htdocs/xampp
In this case, someone can simply replace the existing index page in htdocs folder or create an index redirection page or modified the “httpd.conf” file in /opt/lampp/etc/ folder.
Scenario 2 – Someone want the default location for localhost is point to /var/www/ folder instead of put their application or web file in /opt/lampp/htdocs/. I found that there are many crappy reply and post in forum like they don’t want other people know about this matter. They don’t give a neat solution how to do that.
Hurm..doesn’t matter, I’ve found the solution here. To change the default folder from /opt/lampp/htdocs/ to /var/www/, I have try to install wordpress to see how it works.
1. I’ve put and extracted my wordpress (wordpress version 2.8.3) folder that I downloaded from HERE to /var/www/html/ folder. So, I will make my default localhost folder pointed to /var/www/html/ wordpress
[root@rhel5 html]# cd /var/www/html
[root@rhel5 html]# ls
wordpress-2.8.3.zip
[root@rhel5 html]# unzip wordpress-2.8.3.zip
.
.
.
[root@rhel5 html]# ls
wordpress wordpress-2.8.3.zip
2. Then, I changed XAMPP default localhost location from /opt/lampp/htdocs/ to /var/www/html/wordpress/ by edited some parameter in httpd.conf, the actual location was /opt/lampp/etc/httpd.conf
Stop the XAMPP for Linux first:
[root@rhel5 etc]# /opt/lampp/lampp stop
Stopping XAMPP for Linux 1.7.1...
XAMPP: Stopping Apache with SSL...
XAMPP: Stopping MySQL...
XAMPP: Stopping ProFTPD...
XAMPP stopped.
Then, edit the httpd.conf file
[root@rhel5 etc]#cd /opt/lampp/etc/
[root@rhel5 etc]# vi httpd.conf
Search for phrase:
DocumentRoot "/opt/lampp/htdocs" and replace with
DocumentRoot "/var/www/html/wordpress"
And at the very bottom of the httpd.conf file put the alias so that I still have access to xampp control panel (it is important to have access to phpmyadmin, to see xampp status etc):
# I still want access to xampp and webalizer.
Alias /xampp /opt/lampp/htdocs/xampp
Alias /webalizer /opt/lampp/htdocs/webalizer
3. Start the XAMPP for Linux, if httpd.conf file configured correctly the result should be like below:
[root@rac01 wordpress]# /opt/lampp/lampp start
Starting XAMPP for Linux 1.7.1...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
4. Access to XAMPP for Linux control panel and open phpmyadmin to create database and database user. In this installation, I’ve created database like below:
The name of the database for WordPress: wp_data
MySQL database username: wp_user
MySQL database password: wppassword
MySQL hostname: localhost
5. Install wordpress, follow the step there. (The link for installation is http://localhost/wp-admin/install.php)
File Location: http://localhost/wp-admin/install.php
6. After completed the WordPress installation steps, the result was as shown below:
File Location: http://localhost/
The http://localhost/ was appear as WordPress main page instead of XAMPP for Linux default page.
Conclusion: It was possible to set the default page at /var/www/html/ instead of /opt/lampp/htdocs/
You are welcome Suresh
good God you wrote this… there’s no direct or many guide for this problem
i’ve been using xampp in Windows and just recently a full fledged Linux user. another great person like you will help to encourage others to try out Linux! pls allow me to rewrite this on how people can access xampp files… thanks!!!
5:37 pm
THANKS BROTHER