I'm trying to set up a custom alias for all domains on the server - a custom autodiscover setup, so that for all domains, the path "/autodiscover/autodiscover.xml" is sent to a file on the server "/home/ruonline/public_html/autodiscover.php"
This is exactly the question asked in the link below, but the answer is unclear, and the link in the discussion is dead.
forums.cpanel.net
After reading another forum post (link below), I've been able to do something similar, and set up a 301 redirect for this "/autodiscover/autodiscover.xml" path using the following code in Apache's Include Editor (pre main include):
RewriteOptions inherit
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{REQUEST_URI} ^/autodiscover.xml
RewriteRule ^(.*)$ https://autodiscover.myotherdomain.tld/autodiscover/autodiscover.xml [R=301,L]
This redirect works, but I need to serve a file from the server (masked), rather than just redirect to a URL like this script does.
When I try to change the RewriteRule to:
RewriteRule ^(.*)$ /home/user/public_html/autodiscover.php
I get a 404 error.
Can anyone please help me with this?
This is exactly the question asked in the link below, but the answer is unclear, and the link in the discussion is dead.
Apache Alias for all domains on the server
I am trying to set up an Alias for Apache that will work on all domains on my server. Something similar to the /cpanel /whm and /webmail redirect that cPanel has by default. I know I can add an Alias in the include for each user/domain by adding a .conf file in the...
After reading another forum post (link below), I've been able to do something similar, and set up a 301 redirect for this "/autodiscover/autodiscover.xml" path using the following code in Apache's Include Editor (pre main include):
RewriteOptions inherit
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{REQUEST_URI} ^/autodiscover.xml
RewriteRule ^(.*)$ https://autodiscover.myotherdomain.tld/autodiscover/autodiscover.xml [R=301,L]
This redirect works, but I need to serve a file from the server (masked), rather than just redirect to a URL like this script does.
When I try to change the RewriteRule to:
RewriteRule ^(.*)$ /home/user/public_html/autodiscover.php
I get a 404 error.
Can anyone please help me with this?
Last edited by a moderator: