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 8827287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:20:15+00:00 2026-06-14T07:20:15+00:00

I want to have a sub domain that points to a folder outside the

  • 0

I want to have a sub domain that points to a folder outside the normal public root folder.

httpdocs/
sub_dom/

So say “admin.domain.com” points to “sub_dom” while “domain.com” points to the regular httpdocs folder.

  1. is this possible
  2. is there a better solution (for example would it be better/more advisable to do it another way)

Currently the htaccess file contains this but it does not seem to do the trick:

RewriteCond %{HTTP_HOST} ^admin\.domain\.com$
RewriteRule ^/(.*) /var/www/vhosts/domain.com/sub_dom/admin/ [redirect,last]

There is most probably something very wrong with the second line maybe?

  • 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-14T07:20:16+00:00Added an answer on June 14, 2026 at 7:20 am

    is this possible

    It is in vhost or server config. It is not possible using an htaccess file unless you can already access the /sub_dom/ directory via your regular domain. You can’t access any directory outside of your document root using your htaccess file.

    is there a better solution (for example would it be better/more advisable to do it another way)

    The correct way to do it is to create a new vhost. Your old vhost should have server names something like this:

    ServerName domain.com
    ServerAlias www.domain.com
    

    In your new vhost, you have:

    ServerName admin.domain.com
    

    And a:

    DocumentRoot /path/to/sub_dom/
    

    The Apache documentation has a tutorial for setting up vhosts.

    Alternatively, you can create an alias from your regular domain, something like:

    Alias /sub_dom /path/to/sub_dom
    

    Then you can use mod_rewrite in your domain.com document root (httpdocs):

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^admin\.domain\.com$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/sub_dom%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/sub_dom%{REQUEST_URI} -d [OR]
    RewriteCond %{DOCUMENT_ROOT}/sub_dom%{REQUEST_URI} -s
    RewriteRule ^ /sub_dom%{REQUEST_URI} [L]
    

    But, you may as well just move /sub_dom/ into httpdocs, it’ll achieve the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this algorithm that I want to implement on VB6. Sub Main() dim
I have a domain 'www.foo.com' and I want to create sub domain 'test.foo.com'. In
I have an unsecured domain and want to create a secured sub-domain. On the
Say I have the following file: http://www.example.com/images/folder/image.jpg I want to serve it on http://s1.example.com/folder/image.jpg
I have a website and a sub-domain that allows users to upload images to
I have one domain (domain.com) with multiple sub-pages that have different sessions (by default)
I have a domain set up: www.domain.com, that runs a codeigniter website. I want
I want to do the following: The user should have his own sub site
I have main categories and sub categories. I want to be able to sort
I have a numpy 2D array self.sub and i want to use it in

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.