Modify .htaccess

"Separat Things on cPanel"

To Run a .htaccess File on your cPanel Server. ErrorDocument 404 /404.html Create One, Save it as .htaccess and create a 404.html or 505.html. Notice: Do you don’t will see this File on your Machine or Computer. Becuase it’s a invisible and hidden File.

space.lucasgatsas.ch



Redirect from HTTP to HTTPS


for any domain .htaccess takes effect on:

         RewriteEngine On
         RewriteCond %{HTTPS} off 
         RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 


for a certain domain, example.com:


         RewriteCond %{SERVER_PORT} 80      
         RewriteCond %{HTTP_HOST} ^example\.com$ [OR] 
         RewriteCond %{HTTP_HOST} ^www\.example\.com$ 
         RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] 



Redirect from non-WWW to WWW


for any domain .htaccess takes effect on:

         RewriteEngine On 
         RewriteCond %{HTTP_HOST} !^www\. 
         RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 
for a certain domain, example.com:
         RewriteEngine On     
         RewriteCond %{HTTP_HOST} ^example\.com$ [NC] 
         RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] 

Redirect from WWW to non-WWW for any domain .htaccess takes effect on:
         RewriteEngine On
         RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
         RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
for a certain domain, example.com:
         RewriteEngine On 
         RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] 
         RewriteRule (.*) http://example.com/$1 [R=301,L]
Changes the directory root for the main domain to public_html/subfolder
         RewriteEngine on 
         RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
         RewriteCond %{REQUEST_URI} !^/subfolder/ 
         RewriteCond %{REQUEST_FILENAME} !-f 
         RewriteCond %{REQUEST_FILENAME} !-d 
         RewriteRule ^(.*)$ /subfolder/$1 
         RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
         RewriteRule ^(/)?$ subfolder/index.php [L] 

“If you are going to walk on thin ice, you might as well dance”