.htaccess tutorial

htaccess Elite


Subdomains and directories...

Using PHP in and with htaccess

Subdomains and directories...

New postby CSTS » 03 Feb 2009 18:32

Hello!!!

I´m programming a webapp and I need know how to "translate" some php GET variables to subdomains and directories... i mean:
Code: Select all
Original script --> http://domain.tld/script.php?var1=subdomain&var2=id&var3=title
Subdomain --> http://subdomain.domain.tld
Sub & directory --> http://subdomain.domain.tld/id/title



The first rule works with
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain.tld
RewriteCond %{HTTP_HOST} ([^.]+)\.domain.tld
RewriteCond %1 !^(www|ftp|mail)$ [NC]
RewriteRule ^(.*)$ script.php?var1=%1 [L,QSA]



But my problem is with the second rule... It takes me more than 3 days and I get... nothing :$ Could somebody helps me?


Thanks a lot for everybody's time ;)


Best regards :D


PD: Sorry for my english
CSTS
 
Posts: 1
Joined: 03 Feb 2009 18:27

Return to PHP and htaccess