Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to point a subdomain to a file

Discussion in 'General Discussion' started by Rocko, Mar 15, 2019.

  1. Rocko

    Rocko Active Member

    Joined:
    Apr 25, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    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
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,738
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Rocko

    Rocko Active Member

    Joined:
    Apr 25, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    151
    Thank you, this is what I need, I knew it was there but I did not remember where.

    I also wonder if someday you will include a couple of examples per option. It is much easier to understand a function with real situations than with an abstract explanation, and cPanel is a stable and mature product.
     
  4. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,738
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Rocko

    Rocko Active Member

    Joined:
    Apr 25, 2007
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    151
    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.
     
    #5 Rocko, Mar 28, 2019
    Last edited by a moderator: Apr 1, 2019
  6. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,738
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    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]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice