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

I need to install a second web application site on a web server and hide the fact that's the same server to user.

So far, I have a web app XYZ that you can access via XYZ.com and which is located on the server somewhere like /var/www/ I need to add another webapp ABC which is located /var/www/abc/ and only permit access to people using the ip address.

i.e :

www.XYZ.com  --> XYZ ( /var/www/ )
1.2.4.199 --> ABC ( /var/www/abc )

I've absolutely no clue how to do that with htaccess. Any help is more than welcomed !

Cheers

share|improve this question
    
I forget that I would like the final url of the ABC web app to be 1.2.4.199/ NOT 1.2.4.199/abc/ –  user14728 Aug 11 '09 at 9:54

2 Answers 2

up vote 4 down vote accepted

This isn't really a htaccess thing, more of a vhost setup thing. http://httpd.apache.org/docs/2.0/vhosts/examples.html

share|improve this answer
    
After talking with the tech guy at my provider, it's the way we will go. Thank you. –  user14728 Aug 12 '09 at 7:53

Place a .htaccess in /var/www/abc

Order deny,allow
Deny from all
Allow from 1.2.4.199

RewriteCond %{HTTP_HOST} ^www.XYZ.com$ [NC]
RewriteRule ^(.*)$ - [R=404,L]

This should give visitors to www.XYZ.com a 404 (Not found) when they try to access http://www.XYZ.com/abc (R=404 is undocumented but should work)

(note untested, but you get the idea)

share|improve this answer
1  
Ryaner has the correct answer, mine was based on that he wanted to protect the /abc/ folder and that VirtualHosting was already setup. My use of 404 as error is to hide the fact that there are a /abc/ folder. –  rkthkr Aug 11 '09 at 11:06

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.