Jump to content

subdomain using .htaccess

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
fkabeer

fkabeer

    Newbie

  • Members
  • Pip
  • 3 posts
My problem is apache related:
I want 2 do translate
[value].domain.com to domain.com/index.php?id=[value]

i found this

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} !^www\.domain.com
   RewriteCond %{HTTP_HOST} ([^.]+)\.domain.com
RewriteRule ^(.*)$ /?id=%1
</IfModule>
it isn't working . it event doesn't browse the page

Edited by Jaan, 12 August 2008 - 12:47 AM.


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You have to add the subdomain as a subdomain first so that it is added to DNS. Make the location the point to the root dir of domain.com/.

You can then use something like you have above. Here is what we use for the CodeCall blog:

RewriteCond %{HTTP_HOST} ^blog\.codecall\.net$ [NC]
RewriteRule ^$ /index.php?option=com_myblog [L]

RewriteCond %{HTTP_HOST} ^blog\.codecall\.net$ [NC]
# Ignore requests to existing files (index.php).
RewriteCond %{SCRIPT_FILENAME} !-f
# Ignore requests to existing directories.
RewriteCond %{SCRIPT_FILENAME} !-d
# Match the URI, pass it on.
RewriteRule ^([^/]+)/?$ /index.php?option=com_myblog&task=$1 [L]


#3
fkabeer

fkabeer

    Newbie

  • Members
  • Pip
  • 3 posts
i believe there is some mis understanding between us the [value] here is "user driven" let say "username" and i want it to recieve it in $_GET variable e.g,
xyz.domain.com to domain.com/?name=xyz
echo "Welcome Mr. " . $_GET[name]; output Welcome Mr. xyz
location redirection is a piece of cake and its option is available in cpanel
any help.

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I see, you will need to setup your httpd.conf file to point *.yourdomain.com to your root directory (yourdomain.com). Otherwise this will not work.

#5
fkabeer

fkabeer

    Newbie

  • Members
  • Pip
  • 3 posts
where can i find "httpd.conf" in cpanel, i looked for it but i haven't found it

#6
Guest_Jordan_*

Guest_Jordan_*
  • Guests
In Cpanel I believe you can add *.yourdomain.com as a subdomain pointing to your root. If not, contact your server administratior(s). They should be able to help you with that.