is this possible???

Using a single web hosting account to host multiple sites

is this possible???

Postby bXs » Mon Sep 24, 2007 1:44 am

Ok... i've read allmost every topic on this forum, but i couldn't find solution for my selfe :(

what do i nead...

i have url:
http://www.site.com/what.php?do=1&name=cat

i want to, if it's possible, to create subdoman based on the name... so url should looks like this:
http://cat.site.com

is there solution for this 8)

thanks

P.S.
i have some more questions but i want to be clear with this first :P
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby richardk » Mon Sep 24, 2007 11:11 am

Does the value of do change? If it doesn't, it can be done. You will need to create DNS records for the sub domains (or create a Wildcard DNS record to enable all sub domains) and configure the server to send them all to one directory on the server where the .htaccess and what.php file are (ask your host).
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.domain\.com$ [NC]
RewriteRule ^$ /what.php?do=1&name=%2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby bXs » Mon Sep 24, 2007 3:33 pm

yes it does... based on id, i get the name :(

but, i could maybe change it, and create link like http://www.site.com/index.php?name=cat

i think that is not problem :P

i created link with id becouse database is responding faster... if u have a big name for example a sentance, imagine how much time would it take to find that field in big database :D

i know that you know that stuff, but... i like to explain reason why am i doing it on that way :)
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby bXs » Mon Sep 24, 2007 3:43 pm

ok... here is full link:

http://www.site.com/folder/index.php?do ... %20To%20Do

in

http://what-to-do.site.com/folder

that is my real situation... i could give you a real link if u want to :)

also, there are some more functions based on th same name... like

http://www.site.com/folder/index.php?do ... %20To%20Do

and link would go like:
http://what-to-do.site.com/folder/more

also... if user visit only www.site.com/folder/index.php... it's ok :)... he'll get information on that site :P

i think that this situation is now coplicated :P
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby richardk » Tue Sep 25, 2007 12:37 pm

You need to include all the data you need (all the parts that change) in the new URL. Maybe <name>.site.com/folder/<id>/more or similar.

Also see: How to change a numeric ID into a name/title.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby bXs » Thu Sep 27, 2007 4:13 pm

thanks, i'll try it :)
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby bXs » Mon Oct 01, 2007 1:35 pm

hy... i have new question :)

i'm making language site, and have lang links... like:

index.php?action=srch&lang=xx

htaccess is:

RewriteRule ^(|en\/|bs\/)srch/?$ index.php?action=srch&lang=$1 [L]

now i have problem... becouse this site is hugeeeee i have many links...

is it possible to put this function i created in front of all links in website

what i nead to do now is to put <? function() ?> in front of all links if i want to get as result www.something.com/en/url...

can you understand what i want :D
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby richardk » Mon Oct 01, 2007 3:10 pm

^(|en\/|bs\/)srch/?$

Code: Select all
^(en/|bs/)?srch/?$


is it possible to put this function i created in front of all links in website

what i nead to do now is to put <? function() ?> in front of all links if i want to get as result

You can, but not with mod_rewrite. Mod_rewrite does not change anything in the source of you pages. Maybe you could use a search and replace.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby bXs » Thu Oct 04, 2007 12:21 am

richardk wrote:
^(|en\/|bs\/)srch/?$

Code: Select all
^(en/|bs/)?srch/?$



what is the diference bettwen those two... both of them are working... second is faster becouse there is less characters :P hihi :D ???
bXs
 
Posts: 8
Joined: Mon Sep 24, 2007 1:38 am

Postby richardk » Thu Oct 04, 2007 1:35 pm

what is the diference bettwen those two

I doubt there's any difference, it's just how i'd write it. You don't need to escape /s and ? is the usual way of making something optional.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Next

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 7 guests

cron