• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Redirect subdirectory

N

networkthinking

Guest
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
 
Or you could try using mod_alias:

http://httpd.apache.org/docs/2.0/mod/mod_alias.html#alias
The Alias directive allows documents to be stored in the local filesystem other than under the DocumentRoot. URLs with a (%-decoded) path beginning with url-path will be mapped to local files beginning with directory-path.
Example:

Alias /company1 /site1/company1

Syntax: Alias URL-path file-path|directory-path
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.
 
Back
Top