Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Apache2 CentOS 6

I am trying to work out how to make an Apache VHost send all of its requests to an index page as a kind of bootstrap. I do not wish to alter the look of URL, however all requests should call the same index.php file..

The above examples should all land on the index page..

Thanks for any help.. My brain is hurting from this..

EDIT: I seem to get somewhere until i surf to an existing directory.. At this point, the rewrite rules dont seem to work..


<VirtualHost *:80>
   ServerName project_boot
   DocumentRoot /var/www/html/project_boot

   <Directory "/var/www/html/project_boot">
      AllowOverride None
      RewriteEngine On
      RewriteRule ^/.*$ /index.php [QSA,L]
share|improve this question
ServerName project_boot does this actually exist ? i.e. is there a way for a client to land on this vhost and use this hostname ? Prove (with logs) that anything actually lands on this vhost. – adaptr Oct 18 '11 at 14:53
up vote 1 down vote accepted

Please, please direct people to the current documentation!

The above "solution" specifically causes a [R]edirect - which is not what the OP wants.

Outside your vhost:

LoadModule rewrite_module modules/

Inside your vhost:

AllowOverride None
RewriteEngine On
RewriteRule ^/.*$ /index.php [QSA,L]

The allowoverride disables any .htaccess files that may exist, and the QSA appends any existing query string to the new URL (if that is what you want).

share|improve this answer
Thanks for the reply.. I have added your changes to my VHOST conf, but it appears to not be applying.. I will paste into the OP. Thanks again.. – Lee Oct 18 '11 at 14:50
Ok thank you, i see where i was going wrong.. Almost there now.. I just need to ignore css/js and image files.. – Lee Oct 18 '11 at 15:01
You could pass the rest of the URL as an argument: RewriteRule ^/(.*) /index.php?rest=/$1 [QSA,L] – Olivier Pons Oct 18 '11 at 16:31


RewriteEngine on
RewriteRule   ^/.*  /  [R]



share|improve this answer
Sorry, didnt work. I tested something like that.. I always ran into the problem of the index.php page being added.. or when a directory that existed was added in the URI, it allowed it through. – Lee Oct 18 '11 at 13:48

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.