So I have a rewrite rule that enables WWW to any domain inside the .htaccess for cPanel.
RewriteEngine On
RewriteCond %{HTTP_HOST} !$
RewriteCond %{HTTP_HOST} !www. [NC]
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
The problem is, that I'm trying to put this into a one liner.
echo -e "RewriteEngine On \nRewriteCond %{HTTP_HOST} !$\nRewriteCond %{HTTP_HOST} !www. [NC] \nRewriteCond %{HTTPS}s on(s)| \nRewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] " >> .htaccess
I try this, but here are the results:
RewriteEngine On
RewriteCond %{HTTP_HOST} -e$
RewriteCond %{HTTP_HOST} -ewww. [NC]
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
[link][7 comments]