I've just edited my .htaccess file. All works as it should, but I'm not too familiar with regular expressions and want to make sure that there aren't any unintended consequences. I want to:Add www to the domain if it's not there (i.e. domain.com becomes www.domain.com)redirect from secondary.primary.com to www.secondary.com (the site is a subdomain of another site but the two aren't related and the primary domain shouldn't be included in the URL for the site).redirect domain.com/staging to staging.domain.com.Here are my rules:# Add www if not there RewriteCond %{HTTP_HOST} ^secondary\.com$ [NC]RewriteRule (.*) http://www.secondary.com/$1 [R=301,L]# Prevent search engine from using secondary domain i.e. secondary.primary.com and instead use secondary.com RewriteCond %{HTTP_HOST} ^(www\.)?secondary\.primary\.com$ [NC]RewriteRule (.*) http://www.secondary.com/$1 [R=301,L]# Prevent access to staging through secondary.com/staging and instead use staging.secondary.com RewriteCond %{HTTP_HOST} ^secondary.com [NC]RewriteRule ^(.*)$ http://www.secondary.com$1 [L,R=301]RedirectMatch 301 ^/staging/(.*)$ http://staging.secondary.com/$1
Redirect for subdomains and secondary domains
regex;.htaccess