Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    5

    Default Cpanel alias?

    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?
    Last edited by Infopro; 04-11-2008 at 04:57 AM.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by myclubguru View Post
    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?
    Why not take auctions.shtml and place iton auctions.myclubguru.com and rename it index.shtml and simply link to that page instead?

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    5

    Default

    Quote Originally Posted by cPanelDavidG View Post
    Why not take auctions.shtml and place iton auctions.myclubguru.com and rename it index.shtml and simply link to that page instead?
    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. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,892
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb

    That sounds like an easy way to go to me. You're only renaming 1 file and setting up a sub domain.

  5. #5
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by myclubguru View Post
    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?
    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. #6
    Member LiNUxG0d's Avatar
    Join Date
    Jun 2003
    Location
    Gatineau, Quebec, Canada
    Posts
    206

    Default

    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,
    http://www.okteck.com/
    The best web hosting, reseller hosting and dedicated server packages!

  7. #7
    Member
    Join Date
    Apr 2008
    Posts
    5

    Default

    Quote Originally Posted by LiNUxG0d View Post
    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,
    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. #8
    Member LiNUxG0d's Avatar
    Join Date
    Jun 2003
    Location
    Gatineau, Quebec, Canada
    Posts
    206

    Default

    Quote Originally Posted by myclubguru View Post
    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
    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:

    Quote Originally Posted by LiNUxG0d
    - You want that when someone goes to sub.domain.com that it shows domain.com/file.shtml
    I meant to say:

    Code:
    - 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
    Don't knock it before you try it. It works, had you tried it. lol

    Let me know,
    Last edited by LiNUxG0d; 04-14-2008 at 12:45 PM.
    http://www.okteck.com/
    The best web hosting, reseller hosting and dedicated server packages!

  9. #9
    Member
    Join Date
    Apr 2008
    Posts
    5

    Default

    Quote Originally Posted by LiNUxG0d View Post
    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:
    - 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
    Don't knock it before you try it. It works, had you tried it. lol

    Let me know,

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

  10. #10
    Member
    Join Date
    Apr 2008
    Posts
    5

    Default

    Quote Originally Posted by LiNUxG0d View Post
    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,
    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. #11
    Member LiNUxG0d's Avatar
    Join Date
    Jun 2003
    Location
    Gatineau, Quebec, Canada
    Posts
    206

    Default

    Quote Originally Posted by myclubguru View Post
    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
    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,
    http://www.okteck.com/
    The best web hosting, reseller hosting and dedicated server packages!

Similar Threads & Tags
Similar threads

  1. Can I Alias a SubDomain in cPanel?
    By gene303 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-02-2008, 02:51 PM
  2. Replies: 0
    Last Post: 12-11-2007, 01:44 PM
  3. Mod Alias - Cpanel Dir
    By mbd5882 in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 06-08-2006, 10:44 AM
  4. /cpanel /whm /webmail alias
    By phred02 in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 01-14-2006, 11:04 AM
  5. How do I Alias a SubDomain in cPanel?
    By jondolar in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-21-2005, 01:15 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube