How to edit the htaccess file

The .htaccess file is a powerful configuration file used by Apache web servers. It allows you to control how your website behaves — for example, enabling redirects, managing caching, blocking IPs, or forcing HTTPS.

The htaccess file is found at the root of your website's files. To access your website files you will need to login to your web server.

  1. Log in to your Client Area: https://www.thexyz.com/account
  2. Enter your email address as the username and your client area password. If you do not remember this or have it saved to a password manager, you can request a reset via the 'Forgot Password' button.
  3. Once logged in, click the Services tab as pictured below.find htaccess
  4.  You can then find your Web Hosting service from the list of services. find htaccess
  5. On the left under Actions, click Login to Cpanel.https://www.thexyz.com/images/support/htaccess1.png
  6.   Once logged in, click the File Manage icon.
  7. In the public_html directory, you will find .htaccess

⚠️ Note: If you don’t see the .htaccess file, click Settings in the top-right corner of File Manager and enable Show Hidden Files (dotfiles).

Common Uses: Redirects and HTTPS Rules

The .htaccess file is often used for URL redirects — for example, when moving pages, switching domains, or enforcing HTTPS.

1. Redirect a Single Page

Redirect one page to another:

 
Redirect 301 /old-page.html https://www.example.com/new-page.html
  • 301 means a permanent redirect, which is best for SEO.

  • Replace the old and new URLs with your own.


2. Redirect an Entire Website

If you’ve moved your site to a new domain:

 
Redirect 301 / https://www.newdomain.com/

This will forward all traffic from your old site to the new domain.


3. Force HTTPS (Secure URL)

To automatically redirect all visitors to the HTTPS version of your website, add:

 
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

4. Redirect www to non-www (or vice versa)

To remove “www”:

 
RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

To add “www”:

 
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]

Important Tips

  • Backup your .htaccess file before making changes.

  • Even a small typo can cause your site to stop loading.

  • Use File Manager’s code editor or a plain-text editor like Notepad.

  • After editing, clear your browser cache to test redirects properly.

  • 55 A felhasználók hasznosnak találták ezt
Hasznosnak találta ezt a választ?

Kapcsolódó cikkek

Markdown

You can now add markdown to support tickets at Thexyz. Emphasis **bold** *italics*...

MySQL commands to speed up your WordPress database

phpMyAdmin is the most common way to manage a WordPress database. It is important to backup and...

Setting up WebDav with Nextcloud and ownCloud

ownCloud 10 introduced some changes to connecting with WebDav. This tutorial will show you how to...

Forcing Weebly to use SSL

Usually with Weebly sites, the SSL option is only available for business and performance...

Make Thexyz your homepage

You can quickly get to Thexyz Webmail or Thexyz Start Page every time you open your browser by...