Setup:
- Server Domain:
redir.example.com
- subdomain of above:
*
- CNAME value of
*.redir.example.com = redir.example.com
<anything>.redir.example.com
get servedredir.example.com/index.php
(but no URL Change in browser address bar, as intended).
- subdomain of above:
- Client Domain:
example.xyz
- subdomain of above:
test
- CNAME value of
test.example.xyz = test.redir.example.com
- Desired result of above: server at main domain receives the
test.example.xyz
.
- subdomain of above:
Problem:
test.example.xyz
gets auto-redirects tohttp://test.example.xyz/cgi-sys/defaultwebpage.cgi
- Apache sitting at main domain serves a generic error page with cPanel Branding & text
SORRY!, There has been a server misconfiguration.
with response code200 OK
. This, i believe, Apache says it does not recognisetest.example.xyz
& thus does not know what folder/files it should serve for this request.
Can cPanel/Apache be forced to accept all incoming CNAME values?
Note:
- http://redirect.center does this. Try http://anything.redirect.center, the php code at https://github./...../index.php "gets" the value, & processes accordingly. I am struggling to achieve this above "gets" step. My .php can process only if it receives the URL.
Another working example with redirect.center, with NO DNS records on their side, & them just processing the incoming URL based on URL itself.
http://tex.lab.dc1.in/tags goes to https://tex.stackexchange.com/tags
tex CNAME tex.stackexchange.com.opts-uri.redirect.center.
- redirect.center "gets" the full domain tex.lab.dc1.in, & processes it according to its php (fetching it CNAME value, setting headers & redirects etc..).
How does it "gets/receives" the domains pointed to itself via CNAME records? How has it configured its apache (yes, it uses Apache) to receive & serve all wildcard domains?
EDIT:
OK, found out that I also need to add the following code block in my httpd.conf
file
<VirtualHost *:80>
DocumentRoot /opt/redirect.center/public_html
ServerName redirect.center
<Directory /opt/redirect.center/public_html>
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /opt/redirect.center/redirect
ServerName alias.redirect.center
ServerAlias *
<Directory /opt/redirect.center/redirect>
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
So, now the question becomes, Can we edit/add https.conf
files on cPanel?