adrianTNT Posted February 8, 2009 Share Posted February 8, 2009 Hello, I want to remove the "www" from address bar and this code works: RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC] RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] But... same .htaccess file will be used for multiple domains, how would the above code look if I want it work for any typed domain, not an exact given sample like above? Something like: RewriteCond %{HTTP_HOST} ^www\.($any_domain)\.com$ [NC] RewriteRule ^(.*)$ http://($any_domain).com/$1 [R=301,L] Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/144273-removing-www-from-address-bar-for-any-domain/ Share on other sites More sharing options...
crashmaster Posted February 10, 2009 Share Posted February 10, 2009 have you tried to user (.*) instead of ($any_domain) ?? Quote Link to comment https://forums.phpfreaks.com/topic/144273-removing-www-from-address-bar-for-any-domain/#findComment-758865 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.