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.

Assuming i have the following project structure

Root
- Frontend
-- index.php
- Backend
-- index.php

I want my www.mysite.com to use /www/root/frontend as the document root while /www/root/backend to be the document root if www.mysite.com/admin was requested. Note: Alias does exact match with /admin/ while i need /admin/* to work for the second case.

How should i go about this?

Thanks

share|improve this question
add comment

1 Answer

In your Apache virtualhost config

RewriteEngine On
RewriteCond %{REQUEST_URI} ^admin [NC]
RewriteRule ^(.*)$ /www/root/backend/$1 [L]

So in context

<VirtualHost *:80>
  ServerName www.example.com

  DocumentRoot /www/root/frontend

  RewriteEngine On
  RewriteCond %{REQUEST_URI} ^admin [NC]
  RewriteRule ^(.*)$ /www/root/backend/$1 [L]
</VirtualHost>
share|improve this answer
add comment

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.