How can I configure Apache httpd on a CentOS 7 server so that requests for any path under home.mydomain.com are only served if the referrer for the request was from a path under mydomain.com? And so that requests from referrers other than mydomain.com are redirected to mydomain.com/login?

Here are the VirtualHost definitions for mydomain.com and for host.mydomain.com:

<VirtualHost www.mydomain.com:80>
    ServerName www.mydomain.com
    ServerAlias mydomain.com
    ErrorLog /var/log/httpd/mydomain_com_error.log
    CustomLog /var/log/httpd/mydomain_com_requests.log combined
    DocumentRoot /var/www/mydomain.com/public_html

<VirtualHost home.mydomain.com:80>
    ServerName home.mydomain.com
    ProxyPass / http://localhost:4000/ connectiontimeout=5 timeout=30

Try this :-

< VirtualHost home.mydomain.com:80>

ServerName home.mydomain.com

order Allow,Deny

Allow from

Allow from mydomain.com

< /VirtualHost>

For more information See http://httpd.apache.org/docs/2.2/en/mod/mod_authz_host.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.