Apache Virtual Host Redirect: *.example.com to www.example.com -


I'm just trying to redirect to any example.com at www.example.com. Redirect to example.com at www.example.com // Sends on

The following code is in my virtual host configuration file:

  RewriteCond% {HTTP_HOST} ^ Suksanvillas \ .com $ [nc] Rewrite rules ^ (. *) $ Http : //www.suksanvillas.com/$1 [R = 301, L]   

Tutorials suggest all this happening, but I am unable to understand how I redirect I am raising additional "/"

PS: Other subdomains, for example, "guides.examples.com" should not be redirected.

Thank you.

Avoid capturing a major slash using "^ /" at the beginning of the pattern:

  RewriteRule ^ / (. *) $ ...   

With that small change everything should work a great deal.

Comments