Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a php application which I use to place in:


And mantis and phpmyadmin in:


The application used to be accessed as:

And the others as: 

We've had to make certain changes in our application and need to shift the application from /beta/ to / (ie the document root).

I'm not comfortable with having mantis, phpmyadmin as subfolders in public_html - I'm afraid they may be accidentally deleted / tampered by me / other admins.

How can I setup my httpd.conf so that I can continue accessing my mantis and phpmyadmin as: 

as well as keep the "application" at:


My current httpd.conf reads as:

<VirtualHost IPADDRESS:80>
    DocumentRoot /var/www/html
    UseCanonicalName On

 <IfModule mod_rewrite.c>
    RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
share|improve this question
Is this a shared host, or do you have full control of the config? – SmallClanger May 13 '11 at 8:15
@SmallClanger - Hi. I have full control of the system. Please see added httpd.conf details as well. – siliconpi May 16 '11 at 9:47
up vote 0 down vote accepted

Do you need to keep them in folders under the main domain, or can you put them on subdomains?

You can keep the application, mantis and phpmyadmin in separate folders, set up 3 virtual domains for each of them, eg:

<VirtualHost *:80>
    DocumentRoot /var/www/html/public_html

<VirtualHost *:80>
    DocumentRoot /var/www/html/phpmyadmin

<VirtualHost *:80>
    DocumentRoot /var/www/html/mantis

So application straight into public_html, phpmyadmin into /var/www/html/phpmyadmin, and mantis into /var/www/html/mantis.

Then just set up the additional DNS and access the sites with:

share|improve this answer
thanks @Demelziraptor (nice name btw) - i think i have to end up doing that, but i've already got the mantis bugs referenced like: – siliconpi May 20 '11 at 11:47
thanks Dzr - interestingly, the order mattered a lot...! – siliconpi May 28 '11 at 1:03

You should be able to do a rewrite rule in .htaccess, something like RewriteEngine on

RewriteBase /
RewriteRule ^(?!mantis)(?!phpmyadmin)(.*)$ beta/$1 [L]

(That will redirect every request to the /beta/ subfolder unless it starts in ether mantis or phpmyadmin, also it was done from memory so if you get a syntax error it's just my ineptness at regular expressions)

share|improve this answer
sorry, i'm a bit confused... where should my application be now? I'm not sure if you read my question correctly, I'm moving it from public_html/beta/ to public_html/ – siliconpi May 13 '11 at 10:47
@matt74tm You don't need to move the files for this to work, you can keep the application in /beta/, while the public URL is still /. That solves your problem of people accidentally deleting stuff (They would all be in the beta directory) without having to do some complicated directory configs/permissions to get everything working – Smudge May 13 '11 at 13:16
Hi. Please see added httpd.conf details - what do i need to change in my current system to make it work as desired? – siliconpi May 16 '11 at 9:47
@matt74tm Add those rewrite rules just after the last 'RewriteRule' in your httpd.conf (Where the ... is in the post, just put them there) – Smudge May 22 '11 at 11:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.