Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

[SOLVED] How to change the web root folder?

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
openyk
Posts: 14
Joined: Tue Jul 15, 2014 8:52 pm

[SOLVED] How to change the web root folder?
  • Quote

Post by openyk » Tue Jul 15, 2014 11:37 pm

VestaCP comes with the default web folder as /home/admin/web/default.domain/public_html

How can I change the web folder to instead be /home/admin/web/default.domain/public_html/some_folder ?

Specifically, I have a symlink to the project folder right now: ...public_html/project_folder_symlink
And I would like to browse to my project with http://IPADDRESS instead of having to go to http://IPADDRESS/project_folder every time.

I know the answer lies somewhere in /etc/apache2/ but I've explored a bit and I just do not know exactly where to make the change.

Solution using .htaccess file:

This solution may have path to file issues, I prefer the solution below with the apache configuration.
Add a .htaccess file to the /public_html/ folder and add the rewrite code:

Code: Select all

# Example with domain name
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]

Code: Select all

# Example with IP address
RewriteEngine on
RewriteCond %{HTTP_HOST} ^123.456.78.910$ [NC,OR]
RewriteCond %{HTTP_HOST} ^123.456.78.910$
RewriteCond %{REQUEST_URI} !folder/
RewriteRule (.*) /folder/$1 [L]
Solution with apache configuration file:

For quick reference: vim is a command line text editor, press i to go into insert mode, esc to cancel insert mode, :w to save, and :exit to exit.

Code: Select all

# Open web configuration file
vim /home/admin/conf/web/apache2.conf

# Add the upload folder to the lines with /public_html/
...
DocumentRoot /home/admin/web/default.domain/public_html/upload/
...
<Directory /home/admin/web/default.domain/public_html/upload>
...

# Restart apache server
apache2ctl restart
Top

EdnaHall
Posts: 1
Joined: Mon May 02, 2016 12:02 pm

Re: [SOLVED] How to change the web root folder?
  • Quote

Post by EdnaHall » Mon May 02, 2016 12:14 pm

I have a symlink to the project folder right now: ...public_html/project_folder_symlink????



best image resizer
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password