How to edit .ht(Hypertext) access file through cPanel File manager? (Video)

Editing the .htaccess file through cPanel File Manager allows you to make server-level configurations for your website, such as redirects, access rules, and performance settings. Here's how you can edit it safely.


Step 1: Log in to cPanel

  1. Open your web browser and navigate to your cPanel login page (e.g., https://yourdomain.com:2083).
  2. Enter your username and password, then click Log in.

Step 2: Access File Manager

  1. In the cPanel dashboard, scroll to the Files section.
  2. Click on File Manager.

Step 3: Locate the .htaccess File

  1. In the File Manager interface, navigate to the root directory of your website:
    • For the primary domain, go to the public_html folder.
    • For subdomains or add-on domains, navigate to the respective folder.
  2. If you cannot see the .htaccess file:
    • Click on the Settings button in the top-right corner of File Manager.
    • Check the box for Show Hidden Files (dotfiles).
    • Click Save.

Step 4: Backup the .htaccess File

  1. Before making any edits, create a backup of the existing .htaccess file:
    • Right-click on the file and select Copy.
    • Save the copy in the same directory or another safe location (e.g., name it htaccess-backup).

Step 5: Edit the .htaccess File

  1. Right-click on the .htaccess file and select Edit.
  2. A pop-up may appear asking to confirm encoding. Click Edit to proceed.

Step 6: Make Changes to the File

  1. In the text editor that opens, make the necessary changes to the .htaccess file.
    • Common configurations include:
      • Redirects:  Redirect 301 /old-page.html http://example.com/new-page.html
      • Deny Access by IP:  Deny from 192.168.1.1
      • Enable Compression:  AddOutputFilterByType DEFLATE text/html text/plain text/xml
    •  

Step 7: Save Changes

  1. After editing, click Save Changes in the top-right corner of the editor.
  2. Close the editor.

Step 8: Test Your Website

  1. Open your website in a browser to ensure it is functioning correctly after the changes.
  2. If the website is broken or shows a server error (e.g., 500 Internal Server Error), revert to the backup file:
    • Rename the backup file to .htaccess to restore it.

Tips for Editing the .htaccess File

  • Make Incremental Changes: Edit only one section at a time and test your website after each change.
  • Use Commenting: Add comments to explain your changes for future reference.
    Example:

              # Redirect old page to new page
                 Redirect 301 /old-page.html http://example.com/new-page.html

  • Validate Syntax: Double-check your syntax, as .htaccess is very sensitive to errors.

Editing the .htaccess file through cPanel File Manager is a powerful way to configure your server. By following these steps carefully, you can make changes safely and efficiently.

  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

Sapnel kullanarak yedekleme nasıl indirilir? (Video)

cPanel kullanarak yedek indirmek basit bir işlemdir. İşte web sitenizin yedeğini...

Sapna Yedekleme Nasıl Oluşturulur ve FTP Sunucusuna Gönderilir? (Video)

cPanel yedeği oluşturmak ve bir FTP sunucusuna göndermek oldukça basit bir işlemdir. İşte bunu...

cPanel'de yedekleme nasıl geri yüklenir? (Video)

  cPanel'de bir yedeklemeyi geri yüklemek oldukça basittir ve web sitenizin verilerini...

cPanel'de hesap şifresi nasıl değiştirilir? (Video)

cPanel'de bir hesap şifresini değiştirmek basittir ve birkaç hızlı adımda yapılabilir....

How to update your contact information in cPanel? (Video)

Updating your contact information in cPanel is important to ensure you receive critical...