I have several small projects I want to host on single virtual host using Zend Framework. The structure is:
apps/
testapp1/
application/
index.php,
testapp2/
application/
index.php
Document root in virtual host looks like: DocumentRoot /var/www/apps/
I need univeral mod_rewrite rule which will transform URLs like /apps/testapp1/xxx into /apps/testapp1/index.php.
Any help will be greatly appreciated as I am trying to resolve that for several hours. Thank You.
If your DocumentRoot for website is
/var/www/apps/, then I guess URLs would behttp://www.example.com/testapp1/ajaxinstead ofhttp://www.example.com/apps/testapp1/ajax. If so — then you need to removeapps/part from these rules.These rules need to be placed in your .htaccess into website root folder.
If you already have some rules there then these new rules needs to be placed in correct place as order of rules matters.
You may need to add
RewriteEngine Online there if you do not have such yet.This rule will rewrite
/apps/testapp1/ajaxinto/apps/testapp1/index.php, no other URLs will be affected:This rule will rewrite ALL URLs that end with
/ajaxinto/index.php(e.g./apps/testapp1/ajax=>/apps/testapp1/index.phpas well as/apps/testapp2/ajax=>/apps/testapp2/index.php):UPDATE:
This “universal” rule will rewrite
/apps/testapp1/xxxinto/apps/testapp1/index.phpas well as/apps/testapp2/something=>/apps/testapp2/index.php: