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.

Assuming i have the following project structure

- 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?


share|improve this question

1 Answer 1

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]
share|improve this answer

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.