1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice

How can I change my start directory.

Discussion in 'Plesk for Linux - 8.x and Older' started by rafcarter, Oct 12, 2005.

  1. rafcarter

    rafcarter Guest

    0
     
    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 ?
     
  2. jamesyeeoc

    jamesyeeoc Guest

    0
     
    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]
     
  3. rafcarter

    rafcarter Guest

    0
     
    thnx I will try it and let you know how it worked out
     
  4. Whistler

    Whistler Guest

    0
     
    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.
     
Loading...