.htaccess file



What is a .htaccess file?
.htaccess (short for 'hypertext access') file is a distributed server configuration file. This means that it configures the server only in the directory the . htaccess file is in. The . htaccess file allows you to set server configurations for a specific directory.

If you see a "404 Not Found" error or if you can not log in to your site, please check your main directory. There should be a .htaccess file. If you don't have this file, none of your links will work.

You can find this file in the main directory of your site files. Depending on the operating system you are using, such setting files may be hidden in your computer. In this case, you may not see this file. If you can't see this file, you can create a new file named .htaccess in the main directory of your site and you can paste the following codes to your .htaccess file.

If you have SSL on your site, you can redirect all links on your site to HTTPS by editing .htaccess file.
You can use one of the following .htaccess options by editing the .htaccess file in your main directory.

Try the following .htaccess options:

Option 1:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]



Option 2:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>​


Option 3:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]​


Option 4:
Redirecting to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]


Option 5:
Redirecting to HTTPS (Without 301 redirection)

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]


Option 6:
Redirecting to HTTPS (A different method)

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

**Do not forget to replace "example.com" with your domain.


Option 7:
Redirecting Non-www URLs to www

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]



Option 8:
Redirecting www URLs to Non-www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]



Option 9:
Redirecting to HTTPS and www

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]



Option 10:
Redirecting to HTTPS and Non-www

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]


NOTE:
If your server automatically redirects to HTTPS, you don't need to update your .htaccess file.


Did you find this article useful?



  • Heyluu Number ID

    Find your Heyluu Number ID.01 - Sign in to your Heyluu Help account at https://help.heyluu.comIn the top right, click your account or company det...

  • Support Tickets - Help & Support

    Learn how the Heyluu Support Tickets worksThe Support Tickets are the most effective and fastest way to help you with all the Heyluu websites.With Hey...

  • Adjusting zoom in chrome browser - Other

    - Use the zoom options in the Chrome menu to make everything on a webpage larger or smaller.- Click the Chrome menu on the browser toolbar.- Find the ...

  • Change password Help & Support

    How to change password On Heyluu Help & Support, go to the principal page Look right part and select circle with your image  Click on profil...

  • Change profile picture Help & Support

    How to do to change profile picture On Heyluu Help & Support, go to the principal page Look right part and select circle Click on profile  O...