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 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

كيفية تنزيل النسخ الاحتياطية باستخدام cPanel؟ (فيديو)

تحميل نسخة احتياطية باستخدام cPanel عملية بسيطة. إليك دليل خطوة بخطوة لمساعدتك في تنزيل...

كيفية إنشاء نسخة احتياطية من Sapna وإرسالها إلى خادم FTP؟ (فيديو)

إنشاء نسخة احتياطية من cPanel وإرسالها إلى خادم FTP هي عملية بسيطة. إليك الطريقة التي يمكنك بها...

كيفية استعادة النسخة الاحتياطية في cPanel؟ (فيديو)

استعادة النسخ الاحتياطي في cPanel بسيطة وتتيح لك استرجاع بيانات موقع الويب الخاص بك...

كيفية تغيير كلمة مرور حساب في cPanel؟ (فيديو)

تغيير كلمة مرور الحساب في cPanel بسيط ويمكن القيام به في خطوات سريعة. اتبع التعليمات...

كيفية تحديث معلومات الاتصال الخاصة بك في لوحة التحكم cPanel؟ (فيديو)

تحديث معلومات الاتصال الخاصة بك في cPanel أمر مهم لضمان تلقيك إشعارات حيوية حول حسابك،...