mod rewrite - Apache vHost mod_rewrite -


i have vhost in apache , want rewrite subdomains subdomain www.domain.tld tld-part should one, user enters.

i looked @ documentation of mod_rewrite, @ least didn't understand :) hope can exlain me.

the actual part in vhost-config ist following,... matches subdomain problem, not tld problem:

rewriteengine on rewritecond %{http_host} ^([a-z.]+)?domain\.de$ [nc] rewritecond %{http_host} !^www\. [nc] rewriterule .? http://www.%1domain.de%{request_uri} [r=301,l] 

but don't understand %1 before domain...

rewritecond %{http_host} ^(?!www\.)(?:[^.]+\.)?(domain\.[^.]+)$ [nc] rewriterule .* http://www.%1/$0 [r=301,l] 

that redirects requests subdomain isn't www, has 0 or 1 sudomain levels, domain domain , has 1 level of tlds. if need, .co.uk, need modification.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -