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

Redirect subdirectory

Discussion in 'Plesk for Linux - 8.x and Older' started by networkthinking, Nov 21, 2005.

  1. networkthinking

    networkthinking Guest

    0
     
    Hello,
    We havea site that needs to redirected due to some existing code. The current code uses:
    http://www.abc.com/company1/index.html

    The directory structure though is:
    www.abc.com/site1/company1/index.html

    Without changing all the code, is there a way to redirect plesk/apache to skip the site1 directory under httpdocs and take people directly to company1?

    /httpdocs/site1/company1

    The older server(non-plesk) did this but I cannot find the redirect or how it is done.

    Thanks,
    Wally
     
  2. brucew

    brucew Guest

    0
     
    Try this in your .htaccess file:
    Code:
    Redirect /company1 [url]http://www.abc.com/site1/company1[/url]
    
    If this is a permanent change, use RedirectPermanent instead of Redirect so that Google et. al. will update their indexes properly.

    For your reference: http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirect
     
  3. ShadowMan@

    ShadowMan@ Guest

    0
     
    Or you could try using mod_alias:

    http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
    Also, the Apache 2.0 docs for mod_redirect are at:

    http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect

    Either way, you would do best to put these into the domain's vhost.conf and/or vhost_ssl.conf file(s), then run the Plesk reconfigure script:

    /usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com

    Then restart the Apache service.

    Edit: Upon re-reading your initial post, I am not sure either Alias or Redirect would have any affect on your own PHP scripts though, since those get processed locally on the server, they don't come in from the client side as an Apache request.
     
Loading...