Rewite a virtual url as subdomain

Using a single web hosting account to host multiple sites

Rewite a virtual url as subdomain

Postby mushipkw » Thu Sep 03, 2009 9:25 am

I have setup a website www.wmskins.com & I have setup a subdomian http://nitrogen.wmskins.com. I have configured it to redirect to http://www.wmskins.com/index.php?file=m ... (generated by CMS) Its working fine. but It also changes the address in the location bar. I am looking for a solution to mask the url http://www.wmskins.com/index.php?file=minicms/cms&id=1 as http://nitrogen.wmskins.com. So, that is shows the subdomain in the location bar.
Similarly I would like to mask http://nitrogen.wmskins.com/download to http://www.wmskins.com/index.php?file=minicms/cms&id=2

How can I achieve it?

I have searched a lot but cant find the solution.
Last edited by mushipkw on Fri Sep 04, 2009 12:49 pm, edited 1 time in total.
mushipkw
 
Posts: 4
Joined: Thu Sep 03, 2009 9:13 am

Postby richardk » Thu Sep 03, 2009 5:21 pm

How have you set up the current redirect?
What happens if you remove the current redirect?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mushipkw » Thu Sep 03, 2009 11:12 pm

richardk wrote:How have you set up the current redirect?
What happens if you remove the current redirect?


I have setup the redirect using cpanel(not using htaccess). And its working fine. If i remove the redirect it gives me an 404 error.
mushipkw
 
Posts: 4
Joined: Thu Sep 03, 2009 9:13 am

Postby richardk » Sat Sep 05, 2009 8:01 am

Set the sub domain to go to a sub directory (eg public_html/nitrogen/) (or even better your document root).

Then (unless you set it to the document root) create a file called index.php in that sub directory with the following in it
Code: Select all
<?php include('../index.php');


Then in a .htaccess file in the sub directory (or document root)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^nitrogen\.example\.com$ [NC]
RewriteRule ^$ /index.php?file=minicms/cms&id=1 [QSA,L]

RewriteCond %{HTTP_HOST} ^nitrogen\.example\.com$ [NC]
RewriteRule ^download/?$ /index.php?file=minicms/cms&id=2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mushipkw » Sat Sep 05, 2009 10:11 am

I have tried the both method but it gets redirected to www.wmskins.com & also changes the url.

Here are my cpanel settings:
Image

the last 2 entries are added by the .htaccess mod suggested by you.
mushipkw
 
Posts: 4
Joined: Thu Sep 03, 2009 9:13 am

Postby richardk » Sun Sep 06, 2009 3:03 pm

Not in that part of cpanel. Remove those settings and add the sub domain normally (not as a redirect).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby mushipkw » Mon Sep 07, 2009 2:17 am

Thanks a lot it worked.
mushipkw
 
Posts: 4
Joined: Thu Sep 03, 2009 9:13 am


Return to Domain Handling

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron