The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cpanel alias?

Discussion in 'General Discussion' started by myclubguru, Apr 9, 2008.

  1. myclubguru

    myclubguru Member

    Joined:
    Apr 4, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I'm working on a site called myclubguru.com and was wondering if it is possible to create alias for pages that show up in the address bar. for example the auctions page exact url is http://www.myclubguru.com/auctions.shtml and i made a sub domain of auctions.myclubguru.com but it just forwards it to the exact link. Is there a way to keep the auctions.myclubguru.com in the address bar?
     
    #1 myclubguru, Apr 9, 2008
    Last edited by a moderator: Apr 11, 2008
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Why not take auctions.shtml and place iton auctions.myclubguru.com and rename it index.shtml and simply link to that page instead?
     
  3. myclubguru

    myclubguru Member

    Joined:
    Apr 4, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    That means i would have to set up another site in dreamweaver and it would get confusing in the linkage of files.
    Is there any other way?
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,468
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    That sounds like an easy way to go to me. You're only renaming 1 file and setting up a sub domain.
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    An alternate way involves manually editing .htaccess to include mod_rewrite rules, which if you're not familiar with regular expressions can be difficult.
     
  6. LiNUxG0d

    LiNUxG0d Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    206
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gatineau, Quebec, Canada
    Okokok,

    Let's give you a solution this time around, shall we? :)

    Let's recap:

    - You have domain.com which has a DocumentRoot of /home/domain/public_html
    - You have sub.domain.com which has a DocumentRoot of /home/domain/public_html/sub
    - You want that when someone goes to sub.domain.com that it shows domain.com/file.shtml

    To achieve this, you need two things:

    - Remove your sub-domain and re-add it using the DocumentRoot of /home/domain/public_html (note: no /sub at the end)
    - Create a .htaccess in your public_html/ with the following:

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
    RewriteRule ^(.*)$ /home/domain/public_html/file.shtml [L]
    
    Voila.

    The catch is that both sub.domain.com and domain.com need to share the same document root, or "folder" so that the .htaccess redirects to the right place.

    I confirmed on my end. The only hitch I had to overcome was that pesky DocumentRoot being the same.

    Let me know if this helps or not and if not, I'll give you a functional example using your domain with step-by-step. :)

    Warmest regards,
     
  7. myclubguru

    myclubguru Member

    Joined:
    Apr 4, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    That is not exactly what I wanted to do I want it so when someone goes to sub.domain.com it show sub.domain.com not domain.com/file.html
     
  8. LiNUxG0d

    LiNUxG0d Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    206
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gatineau, Quebec, Canada
    This is exactly what it does.

    Let me show you what happens on my end.

    I have a domain: domain.com
    I have a sub: sub.domain.com
    I have a file on domain.com: file.php

    With the above .htaccess rules, when I go to: sub.domain.com

    It shows the file domain.com/file.php BUT the address bar shows sub.domain.com.

    This is the behavior you're asking for isn't it?

    I tried myself and it works just right in IE and FF. Browsers display sub.domain.com but I see the contents for domain.com/file.php.

    I see the confusion:

    I meant to say:

    Code:
    [COLOR="Red"]- You want that when someone goes to sub.domain.com that it shows the contents of domain.com/file.shtml but with address sub.domain.com[/COLOR]
    Don't knock it before you try it. :) It works, had you tried it. :) lol

    Let me know,
     
    #8 LiNUxG0d, Apr 14, 2008
    Last edited: Apr 14, 2008
  9. myclubguru

    myclubguru Member

    Joined:
    Apr 4, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1

    Thank You for clearing this up for me. I will try it when I get home.
     
  10. myclubguru

    myclubguru Member

    Joined:
    Apr 4, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I go in to cpanel and make a new sub domain but it won't let me take "sub" of the end. It automatically makes /public_html/partners/ when I make the domain partners.myclubguru.com
     
  11. LiNUxG0d

    LiNUxG0d Well-Known Member

    Joined:
    Jun 25, 2003
    Messages:
    206
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Gatineau, Quebec, Canada
    Ahha...

    Ok, well, if you're running WHM 11, click on Account Functions -> Modify an Account on the left menu, then choose your domain, click Modify and then change your theme to X3 instead of X2. X2 just allows sub.domain.com with no flexibility on the folder. X3 will give you a default location which you can change before creating the sub. :)

    Warmest regards,
     
Loading...

Share This Page