I created www domain redirection in htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
ErrorDocument 404 /
All works, but I do not want enter manualy domain name every time. How to change example.com to dynamic domain name? Can somebody help me?
You can use:
ErrorDocument 404 /
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,NE]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With