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.

Redirect Main domain not sub domain.

Discussion in 'General Discussion' started by DBleeker, Jan 28, 2014.

  1. DBleeker

    DBleeker Registered

    Joined:
    Jan 28, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi, completely new her, wonder if anyone can help with the following problem.

    I run my website domain.com on wordpress hosted by westhost.

    I would like to point the main domain to Photo Deck the company who hosts my image gallery etc.
    (Now under a sub domain archive.domain.com/)

    And then I like to run my wordpress under a sub domain: blog.domain.com

    Somehow I have to redirect the sub domain blog.domain.com and point it to the public_html and redirect domain.com to sites.photodeck.com.

    But how do I go about it? Any help would be appreciated.

    David
     
    #1 DBleeker, Jan 28, 2014
    Last edited by a moderator: Jan 28, 2014
  2. PlotHost

    PlotHost Well-Known Member

    Joined:
    Apr 29, 2011
    Messages:
    253
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    US
    cPanel Access Level:
    Root Administrator
    Twitter:
    Did you try via cPanel-> Redirects ? Ask your hosting company for some help.
     
  3. DBleeker

    DBleeker Registered

    Joined:
    Jan 28, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    I can redirect the main domain that is not the problem.

    But the destination for the redirection of the sub domain must begin with a protocol, e.g., http:// and I want to redirect to the public_html directory of the site.
     
  4. DBleeker

    DBleeker Registered

    Joined:
    Jan 28, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    It seems that I have to manually change the .htaccess file.

    As this way beyond my comfort zone I wonder if anyone can tell me if this is right.

    That is what I understand from this thread: http://forums.cpanel.net/f34/redirect-main-domain-but-not-subdomain-221272.html

    Current .htaccess file:
    ***********************
    RewriteOptions inherit
    # WestHost 4.0 Custom php.ini
    SetEnv PHPRC /home/davidble/public_html/php.ini

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    ************************
    would have to change:
    ************************

    root@host [/home/davidble/public_html]# cat .htaccess
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$
    RewriteRule ^/?$ "http\:\/\/sites.photodeck.com" [R=302,L]
    ***********************


    But I am not sure which part exactly I have to replace?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can modify the document root value for the subdomain by editing the "documentroot" entry in the appropriate cPanel user data file:

    Code:
    /var/cpanel/userdata/$username/$sub.domain.com
    Then, rebuild the Apache configuration file via:

    Code:
    /scripts/rebuildhttpdconf
    Thank you.
     
  6. DBleeker

    DBleeker Registered

    Joined:
    Jan 28, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Sorry that goes over my head.

    I can edit the .htaccess file but I am really looking for confirmation that the code is right???
     
Loading...

Share This Page