You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用cPanel文件管理器重定向主页?含example.com.sg路径跳转咨询

Hey Bryce, great questions—let’s walk through exactly how to set up that homepage redirect using cPanel’s File Manager, including your specific use case.

How to Redirect Your Homepage via cPanel File Manager

First, I’ll cover the general process, then dive into your exact scenario of redirecting example.com.sg to example.com.sg/test.

Step 1: Access cPanel’s File Manager

  • Log into your cPanel account (usually via yourdomain.com/cpanel or your hosting provider’s customer dashboard).
  • Scroll to the Files section and click File Manager.
  • Make sure you’re in your site’s root directory—this is almost always the public_html folder. You can confirm by checking the path at the top of the File Manager window.

Step 2: Locate or Create the .htaccess File

We’ll use the .htaccess file to add our redirect rule. Here’s how to find it:

  • If you don’t see .htaccess in the root folder:
    1. Hit the Settings button in the top-right corner.
    2. Check the box for "Show Hidden Files (dotfiles)" and click Save. Now .htaccess should appear.
  • Right-click on .htaccess and select Edit (or click the Edit icon at the top). A pop-up might ask about encoding—just click Edit again to proceed.

Step 3: Add the Redirect Rule (Your Specific Case)

To redirect your main domain example.com.sg directly to the /test subdirectory, add this line near the top of your .htaccess file (before any existing rules):

RedirectMatch ^/$ /test/

Let me break this down:

  • RedirectMatch uses regex to target specific URLs.
  • ^/$ matches exactly the root URL (your homepage: example.com.sg/).
  • /test/ is the path you want to redirect visitors to.

Permanent Redirect for SEO

If you want this to be a permanent redirect (ideal for search engine optimization, as it passes link equity), add the 301 status code like this:

RedirectMatch 301 ^/$ /test/

Step 4: Save and Test

  • Click Save Changes in the top-right of the editor.
  • Close the editor, then open an incognito window and visit example.com.sg—you should land directly on example.com.sg/test.

Quick Troubleshooting

  • If the redirect isn’t working: Double-check the rule for typos, and make sure there are no conflicting rules in your .htaccess file.
  • If you accidentally break your site: Just go back to File Manager, edit .htaccess, and remove the rule you added—it’ll revert to normal.

内容的提问来源于stack exchange,提问作者Bryce

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 07:56:29