Forum Moderators: phranque

Message Too Old, No Replies

modrewrite , wild card , httpd.conf help

         

dylan34

4:43 pm on May 15, 2006 (gmt 0)

10+ Year Member



i have this page:
www.mydomain.com/firstname-lastname/
www.mydomain.com/user-master/
www.mydomain.com/user-clovm/

and i wanna make it look like this

firstname-lastname.mydomain.com
user-master.mydomain.com
user-clovn.mydomain.com

i've create a 'wild-card' dns record to point all subdomains on my server usign this steps:
"Make sure you have a wildcard DNS entry in Domain > DNS. You can add one as followed:
Set the "Record Type" dropdown to "A" and click the Add button.
In the next screen enter a * (asteriks) in the domain name field, and enter the IP address your subdomain needs to point to."

what should i do next?

dylan34

5:17 pm on May 15, 2006 (gmt 0)

10+ Year Member



if is there another simple way please help me. i'am usign plesk for control panel. tnx

jdMorgan

10:22 pm on May 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should be able to find a lot of info here [google.com].

Jim

dylan34

8:43 am on May 16, 2006 (gmt 0)

10+ Year Member



i need the entry for virtual host in httpd.conf because i cant find anything

dylan34

3:44 pm on May 17, 2006 (gmt 0)

10+ Year Member



i still cant find a solution and the guy from hosting doent not know

coopster

3:56 pm on May 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm assuming at this point all you have left to do is setup Virtual Hosts [httpd.apache.org].

dylan34

5:47 pm on May 17, 2006 (gmt 0)

10+ Year Member



its seem that evrething its set up. all i need right now is the mod rewrite

jdMorgan

5:51 pm on May 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please see your stickymail (link at top of this page).

Jim

moltar

5:58 pm on May 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have a look at vhost_alias module. I think it's what you are looking for.

dylan34

9:05 am on May 18, 2006 (gmt 0)

10+ Year Member



i've found out something :)
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{HTTP_HOST}!^www\.domain\.com?$
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com?$
RewriteRule ^$ /sub1/index.html [L]

if i have the directory sub1 i can accesing by sub1.example.com without problem but i have like 500 directories. should write RewriteRule for all the directories or is a expresion for that?

tnx allot

dylan34

9:14 am on May 18, 2006 (gmt 0)

10+ Year Member



hmmit's seem that any subdomain i type he will redirect me to sub1.example.com

dylan34

9:25 am on May 18, 2006 (gmt 0)

10+ Year Member



i've found out something better
rewriteEngine on
rewriteCond %{HTTP_HOST} .
rewriteCond %{HTTP_HOST}!^www\.example\.com [NC]
rewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com [NC]
rewriteRule ^/(.*) /%1/$1 [L]

but still is a small problem. the directory sub1 it can be access it by sub1.example.com only by sub1.example.com/sub1 any help is welcome . tnx allot

jdMorgan

2:40 am on May 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> but still is a small problem. the directory sub1 it can be access it by sub1.example.com only by sub1.example.com/sub1 any help is welcome . tnx allot

Can you re-phrase that question? It is not clear.

I'd suggest the following modifications to make the rule more robust:


RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteCond %{HTTP_HOST} ^([a-z0-9_]+)\.example\.com
RewriteRule ^/(.*) /%1/$1 [L]

But that is not intended as a solution to your latest question.

Jim