regex - htaccess Rewrite for any domain -
i have following lines written multiple times accommodate multiple domains use. there way write once domain follow same rule?
rewritecond %{http_host} ^(www\.)?example\.com$ [nc] rewritecond %{the_request} \s/+example.com/(\s*) [nc] rewriterule ^ /%1 [r=301,l] rewritecond %{http_host} ^(www.)?example.com$ rewritecond %{request_uri} !^/example.com/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /example.com/$1 [l] rewritecond %{http_host} ^(www.)?example.com$ rewriterule ^(/)?$ example.com/index.php [l]
try single block of rule doamins:
rewriteengine on rewritebase / rewritecond %{http_host} ^(?:www\.)?(.+)$ [nc] rewritecond %1::%{the_request} ^(.+?)::\s/+\1/(\s*) rewriterule ^ /%1 [r=301,l] rewritecond %{http_host}::%{request_uri} ^(?:www\.)?(.+?)::/(?!\1/) [nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ %1/$1 [l] rewritecond %{http_host} ^(?:www\.)?(.+)$ [nc] rewriterule ^/?$ %1/index.php [l]
Comments
Post a Comment