I'm running Linux and apache2. The apache server knows itself as, let's say, domain.com, but dns has been setup to point to this server with the name sub.domain.com. When I enter sub.domain.com, I get a 400 Bad Request page with a link pointing to
https://domain.com. If I click that, I'm told domain.com can't be found, which makes sense because dns is pointing to sub.domain.com. In any case I would like to be able to enter sub.domain.com and get redirected to
https://sub.domain.com/path/to/login.html. The first thing I tried was to put a .htacces file in the DocumentRoot, which is /var/www/localhost/htdocs. Here's the content of .htacces:
- Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://sub.domain.tld/path/to/login.pl [L,R=303]
</IfModule>
After installing this in DocumentRoot, I still got the 400 Bad Request page. I've tried different syntax to no avail, then tried putting the code in httpd without success.
Nothing works.
Could someone point me in the right direction in this matter.
Thank you.