php - creating subdomain with .htaccess -


i not familiar .htaccess . trying create .htaccess file redirect subdomain portfolio.

for example : bob.example.com ,

which redirect bob portfolio. in background script executed following way.

example.com/portfolio.php?id=bob 

i have written following .htaccess

rewritecond %{http_host} !^([w]{3,3}[.]{1,1}){0,1}example.com$ rewritecond %{http_host} ^([0-9a-za-z-]*)[.]example.com$ rewriterule ^.*$ http://example.com/portfolio/index.php?id=%1 [r,l] 

issue , if use bob.example.com redirect example.com/portfolio/index.php?id=bob

if use bob.example.com must open portfolio direct , instead of redirection

alright , managed self create

rewriterule ^$ portfolio/index.php?id=%1 [nc,l] 

above statement works ! thank !

try this:

rewritecond %{http_host} ^([a-z0-9]+)\.domain\.com [nc] rewriterule .* http://domain.com/portfolio/index.php?id=%1 [qsa,r=301,l] 

although wouldn't recommend this. if you're working kind of mvc framework i'm sure it's routing components can accomplish you.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -