Redirect Main domain not sub domain.

DBleeker

Registered
Jan 28, 2014
4
0
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
 
Last edited by a moderator:

DBleeker

Registered
Jan 28, 2014
4
0
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.
 

DBleeker

Registered
Jan 28, 2014
4
0
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:
************************

[email protected] [/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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
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.
 

DBleeker

Registered
Jan 28, 2014
4
0
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???