Forum Moderators: phranque

Message Too Old, No Replies

dynamic url 2 subdomain

         

jazzus

9:41 am on Apr 22, 2005 (gmt 0)

10+ Year Member



hello everybody,
i want rewirite dynamic URL to subdomain form

I want write to browser:
www.subdomain.domain.com

I have written in browser now this:
[domain.com...]

I use this mod_rewrite, but does not work good:
rewriteCond %{HTTP_HOST} ^www\.
rewriteCond %{HTTP_HOST} ^(.+)\.domain\.com
rewriteRule ^([0-9]+)$ [domain.com...] [L]

jazzus

11:41 am on Apr 22, 2005 (gmt 0)

10+ Year Member



also this solution does not work :

rewriteCond %{HTTP_HOST}!^www\.
rewriteCond %{HTTP_HOST} ^(.+)\.domain\.com
rewriteRule ^(.*)$ [domain.com...] [L]

jd01

6:07 pm on Apr 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi jazzus,

What you are trying to do will not work... Not exactly the way you are trying it.

Mod_Rewrite does not actually change or create anything. What it does is gives something, other than what was requested, when a specific request is made.

So a user will actually have to click on a link to www.sub.domain.com. Then you can tell your server through mod_rewrite 'when someone asks for this' (www.sub.domain.com) give them the content from http//www.domain.com/index.php?subdomain=$subdomain.

Exactly how this is done will depend on the settings of your server and the location of the sub.domains.

Hope this helps.

Justin

jazzus

9:28 am on Apr 23, 2005 (gmt 0)

10+ Year Member



Thank you

ok, so how can i deal with this?
i want that this direction: www.domain.com/index.php?id=98

will be readable over browser also on this address: www.98.domain.com

i tryed this and also this does not work
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com
RewriteRule ^(.*) /index.php?id=%1 [L]

Also i have webhosting where is subdir "www"(http://www.domain.com) and there is stored whole webpage, but it's visible also on htt://domain.com (WithOUT www written in URL)

so fizycally there are other subdir in ./ together with dir "www" and this others for example "sub" has this URL: [sub.domain.com...]

I want make fake (not fizycally) subdomain at dir "www" so then it should have this form: [sub.domain.com...] , so i want this URL belong to this dynamic URL [domain.com...] and also at [domain.com...]

How is this possible, Thank you