The current rule I'm using is:
- Code: Select all
rewritecond %{http_host} ^([a-zA-Z0-9]+\.com) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
rewritecond %{http_host} ^([a-zA-Z0-9]+\.net) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
rewritecond %{http_host} ^([a-zA-Z0-9]+\.org) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
rewritecond %{http_host} ^([a-zA-Z0-9]+\.info) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
rewritecond %{http_host} ^([a-zA-Z0-9]+\.us) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
rewritecond %{http_host} ^([a-zA-Z0-9]+\.ws) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
I'm in no way even proficient in mod_rewrite or regex; ideally i'd like one rule and i'm pretty sure it's possible, any help? I don't really understand the tags much, but I'm sure it'd be something like:
- Code: Select all
rewritecond %{http_host} ^([a-zA-Z0-9])\.(com|net|org|info|us|ws) [NC]
RewriteRule (.*) http://www.%1/$1 [R=301,L]
But I'm not sure what the rewrite rule would be or anything like that...
PS, I'm looking for a .htaccess solution vs a httpd.conf solution.