How to point a subdomain to a file

Rocko

Active Member
Apr 25, 2007
26
0
151
Hi,

I want to know the steps to point a subdomain to a file ie:
name.domain.com => domain.com/name.html

Thank you
 

Rocko

Active Member
Apr 25, 2007
26
0
151

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,967
758
263
Houston
cPanel Access Level
DataCenter Provider
Hello @Rocko

I'm glad that worked for you. If at any time you ever have a suggestion that you believe may make our product better I would encourage you to open up a feature request which can be done using the link in my signature. Once it's open you can share the link here for others to vote on as well.


Thanks!
 

Rocko

Active Member
Apr 25, 2007
26
0
151
Hello @Rocko

I'm glad that worked for you.
It did not work. it seems this is not what I need.

This is what I want:

I have this file: http://example.net/lauren.php

I need this address: http://lauren.example.net to point to that file.

When someone enters http://lauren.example.net then http://example.net/lauren.php is shown, the same way than http:// example.net shows http:// example.net/index.html

If I understood I need DNS records for http://lauren.example.net and .httpaccess for http://example.net/lauren.php but I did not see them when I tried:

https?://(www.)?
[ example.net ]
/ [ lauren.php ]
Redirects to
[ http://lauren.example.net ]

Please provide an example to realise what I am making wrong.

BTW: I tried to enter the Submit A Feature Request but I could not enter since it does not recognise the username and password that I use here, unless it is required to create new ones for that system.
 
Last edited by a moderator:

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,967
758
263
Houston
cPanel Access Level
DataCenter Provider
Hello @Rocko

Since you're doing a subdomain you can actually do all of this from cPanel>>Domains>>Subdomains. I set this up on my test server and it's working without issue for me. Here's an example of how it looks on my server:

1. Create the Subdomain:

subdomain_1.png

2. Modify the Subdomain to add the redirection by clicking "Manage Redirection":

redirection_2.png

3. Save it and it should be good to go


This automatically adds the following redirect into the .htaccess as well:

Code:
RewriteCond %{HTTP_HOST} ^mydomain\.us$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.us$
RewriteRule ^/?$ "http\:\/\/mydomain\.us\/lauren\.php" [R=301,L]