.htaccess tutorial

htaccess Elite


calling main domain content into subdomain

Ask your mod_rewrite and Redirection questions here, and get answers!

calling main domain content into subdomain

New postby agriz » 01 Mar 2009 17:47

Hi,

I will explain what i need...

If any one type

http://sub1.domain.com -> It should not redirect. But just get the content form http://domain.com/index.php?subdoamin=sub1

http://sub2.domain.com -> It should not redirect. But just get the content form http://domain.com/index.php?subdoamin=sub2

http://subn.domain.com -> It should not redirect. But just get the content form http://domain.com/index.php?subdoamin=subn


How can i right such a htaccess code?

Any help is appreciated

Thanks
agriz
 
Posts: 3
Joined: 01 Mar 2009 10:34

Re: calling main domain content into subdomain

New postby agriz » 01 Mar 2009 18:01

RewriteCond %{HTTP_HOST} !^\.
RewriteCond %{HTTP_HOST} ^(.+)\.agriz\.in
RewriteRule ^(.*) http://www.agriz.in/index.php?q=$1 [R=301,L]

I tried this but it is redirecting the url. I dont want any redirection
agriz
 
Posts: 3
Joined: 01 Mar 2009 10:34

Re: calling main domain content into subdomain

New postby acmeinc » 07 Mar 2009 03:50

This is actually not a .htaccess issue. Most likely your web server is located on a Unix/Linux server. In this case you could sym-link your index.html (.php, htm, ect) to the index.php of your main domain files. The sym-link will retain the proper sub.domain.com feel in the URL field of your browser.

Command:

ln -s /path/to/your/index.php index.php
acmeinc
 
Posts: 4
Joined: 07 Mar 2009 02:59


Return to Redirect or Rewrite Questions