Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

~/public_html/beta/

And mantis and phpmyadmin in:

~/public_html/mantis/
~/public_html/phpmyadmin/

The application used to be accessed as:

www.mysite.com/beta/

And the others as:

www.mysite.com/mantis
www.mysite.com/phpmyadmin 

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:

www.mysite.com/mantis
www.mysite.com/phpmyadmin 

as well as keep the "application" at:

www.mysite.com

?


My current httpd.conf reads as:

<VirtualHost IPADDRESS:80>
    ServerAlias MYSITE.com
    DocumentRoot /var/www/html
    ServerName MYSITE.com
    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

2 Answers 2

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>
    ServerName MYSITE.com
    ServerAlias www.MYSITE.com
    DocumentRoot /var/www/html/public_html
#etc

<VirtualHost *:80>
    ServerName phpmyadmin.MYSITE.com
    DocumentRoot /var/www/html/phpmyadmin
#etc

<VirtualHost *:80>
    ServerName mantis.MYSITE.com
    DocumentRoot /var/www/html/mantis
#etc

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: www.mysite.com phpmyadmin.mysite.com mantis.mysite.com

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: www.mysite.com/mantis/(blahblah) –  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 –  sam 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) –  sam May 22 '11 at 11:01

Your Answer

 
discard

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.