• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How can I change my start directory.

R

rafcarter

Guest
I want to be able to have my site start in www.xxx.com/CMS

So when someone types www.xxx.com it should start in www.xxx.com/CMS

I have tried changing the document root in httpd.include but for some reason every once in a while it changes on its own to the default httpd.include file and my site gets screwed up cause its looking in wrong directory.

Can some one please tell me the correct way to change the site path on linux or in plesk ?
 
Code:
[b]# Create or edit the /home/httpd/vhosts/domain.tld/conf/vhost.conf file
# and put the following in it.
# Save it, then do /usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.tld
# Then restart the Apache Service
#
# It's not pretty, just quick and dirty, but it works.
#
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteMap	lowercase	int:tolower

# First make sure we add [url]www.[/url] if it wasn't specified
RewriteCond %{HTTP_HOST} !^[url]www.domain.tld[/url]$
RewriteCond %{HTTP_HOST} ^domain.tld$
RewriteRule ^/(.*) [url]http://www.domain.tld/[/url]$2 [R=301,L]

# Now redirect the domain's docroot to a specific folder /CMS
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !/CMS
RewriteRule (.*) [url]http://www.domain.tld/CMS[/url] [R,L]
</IfModule>
#
# If you end up changing anything in this example, other than the domain name, don't come back and say it doesn't work....
#
# The other option would be to put a dummy index.html file into the docroot which does a simple redirect to the /CMS directory.[/b]
 
Originally posted by rafcarter
I have tried changing the document root in httpd.include but for some reason every once in a while it changes on its own to the default httpd.include file and my site gets screwed up cause its looking in wrong directory.

Ever read the notes in top of the http.include file? Ever read the manual?

You're not supposed to write custom changes in the httpd.include file - but in a vhost.conf file as also written by jamesyeeoc.

But changing documentroot seems a bad solution to you problem - either use a rewrite condition in a vhost.conf file or .htaccess in the documentroot - or simply put a redirect request in a index.php / index.html file in the document root.
 
Back
Top