Tag: .htaccess

How to redirect my site from HTTP to HTTPS?

Redirect All Web Traffic To force all web traffic to use HTTPS insert the following lines of code in the .htaccess file in your website's root folder. RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$ RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$ RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L] Be sure to replace www.example.comwith your actual domain name. Redirect Only Specified Domain To force a specific domain to use HTTPS, use [...]

Change HTTP header settings using .htaccess file

First step, if you do not already have a .htaccess file created in the root directory of the affected domain name document. To do this, refer to the following: How to create .htaccess file? If the file already exists, you can edit it as described below: Creating and editing a file via FTP Creating and editing a file via SSH What is the http header? […]

URL redirect/rewrite using the .htaccess file

By default your website can be accessed with both www.example.com and example.com. Since Google penalizes this due to duplicated content reasons, you should restrict the access to either www.example.com or example.com. Some links may be outside of your website scope and/or the search engines may have already indexed your website under both addresses. Using the Redirect tool in the cPanel Redirecting to or from WWW […]

What is the .htaccess file and what do I use it for?

Htaccess files are hidden plain text files that are on the server to help control how your visitors interact with your website. The htaccess file is also used to block specific traffic from being able to view your website. If you look for your .htaccess file you’ll see that there’s no filename. The extension is .htaccess which tells the server what type of file it […]

How to Change your Default Index Page in htaccess

The server looks for specifically named files as the first page of your website, also known as the index page. The default order of index file names our particular servers look through is index.php, index.htm, index.html, and finally default.htm. You can change the name of the index file your account looks for by altering the .htaccess file. Perhaps you want to have a specific custom […]

How to change my document root folder using an .htaccess file?

By default your website is loaded from the public_html folder of your account. The public_html directory is also called web root folder or document root folder. If you’ve created a test website under a sub-folder and you want it to be displayed when you type your domain name, add the following lines to the .htaccess file in the public_html folder: RewriteEngine on RewriteCond %{HTTP_HOST} ^domain-name.com$ […]

How to create .htaccess file?

You can create an .htaccess directly on your web server using an FTP client, cPanel internal File Manager or SSH. View the following articles for instructions on how to use either option to create the file: Creating and editing a file via FTP (easier for beginners) Creating and editing a file via SSH (for advanced users) If you're using an FTP client, make sure it [...]