Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:14:05+00:00 2026-06-13T10:14:05+00:00

I have web site hosted on shared hosting account which is managed by CPanel.

  • 0

I have web site hosted on shared hosting account which is managed by CPanel. It allows to create unlimited sub-domains. I have the following situation:

Suppose that my primary domain there is: mydomain.com
My account’s files are found on the hosting server at /home/myaccount/public_html
I decided to make sub-domain named dir i.e dir.mydomain.com
I created this sub-domain to use the following file:
/home/myaccount/public_html/Hosts/directory

Now I, successfully, able to access http://dir.mydomain.com
However, I need to prevent the access http://mydomain.com/Hosts/directory and exclusively restrict the access to the sub-domain.

How could I achieve this using .htaccess?

The following is a copy of the code I use in the .htaccess file found in /home/myaccount/public_html/Hosts/directory

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>
AddType audio/mpeg mp3
AddType text/xml xml   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:14:06+00:00Added an answer on June 13, 2026 at 10:14 am

    The above answer of Jon Lin does not work. I found that Redirect may solve the problem as follows:

    #.htaccess at public_html
    
    Redirect /Hosts/directory/ http://dir.mydomain.com/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have hosted my website on a shared web-hosting server. However, I am worried
I have a shared hosting site and on it I have 3 websites hosted.
I have an ASP.Net MVC 3 Website hosted on a shared Windows hosting package.
I have a web site hosted on IIS with windows authentication. I am trying
i have a hosted web site and i have an asp.net mvc site. The
I have designed a new web site. I have hosted it online. I want
I have a web site hosted in a CentOS 5-Plesk-Apache server. I have recently
I have my site hosted on IIS hosting. Site has feature that needs calling
I have a WCF web service hosted in IIS7 which is reporting its endpoint
I'm developing a game in PHP+Mysql that is hosted in a shared web hosting.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.