Apache htaccess Zend redirecting excepting some fodlers

Posted by Frederick Marcoux on Stack Overflow See other posts from Stack Overflow or by Frederick Marcoux
Published on 2012-11-04T10:57:09Z Indexed on 2012/11/04 10:59 UTC
Read the original article Hit count: 146

Last week, I remade all of my website using the famous Zend Framework and now, I'm starting worrying about it... I'm trying to make an administration zone within a subfolder (also ZF) and a API Zend Application for my mobile Android application.

The problem is: I rewrited all routes im my principal website, so now it always search for a route when I go to a subfolder.

There's my root folder .htaccess:

RewriteEngine On
RewriteRule ^.htaccess$ - [F]

RewriteCond %{REQUEST_URI}!^/api/
RewriteCond %{REQUEST_URI}!^/admin/
RewriteRule ^public/.*$ /public/index.php [NC,L]
RewriteRule ^(.*)$ /public/$1 [NC,L]

The way I want it is that:

URL: {domain}/ => ./public/index.php (where's my current ZF app)
URL: {domain}/[admin|api] => ./[admin/|api]/public/index.php (the others app)

{domain} = my TLD;
[admin|api] the requested folder

So, in simple:

Request = /api => /api
Request = /admin => /admin
Request = {anything else} => /public/index.php

I searched a lot on SO and also on Google but I didn't find anything working -_-

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about zend-framework