: Go up one directory in mod_rewrite I've got a standard Zend Framework 1 project that looks a bit like this: Project |- public |- .htaccess |- index.php The .htaccess looks like this: RewriteEngine
I've got a standard Zend Framework 1 project that looks a bit like this:
Project
|- public
|- .htaccess
|- index.php
The .htaccess looks like this:
RewriteEngine On
RewriteBase /
RewriteRule ^image/.*$ img.php?file= [NC,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Now I want to start transitioning the site to Zend Framework 2, which I put in a separate directory in the root, so the whole thing looks like this:
Project
|- public
|- .htaccess
|- index.php
|- zf2
|- public
|- .htaccess
|- index.php
What would I have to change in my original (ZF1) .htaccess to route all requests to (for example) /zf2/whatever to ZF2's index.php? I've tried RewriteRule ^zf2(/.*)$ ../zf2/public/index.php [NC,L] in the line after RewriteBase /, but that just gives me a 400 Bad Request.
More posts by @Pierce454
1 Comments
Sorted by latest first Latest Oldest Best
You need mod_alias, not mod_rewrite:
Alias /zf2/ ../zf2/public
Maybe you'll need to specify absolute path instead of relative.
Another solution would be use of a filesystem symbolic link named zf2, placed in Project/public and pointing to ../zf2/public.
In both cases you'll need Options +FollowSymlinks. And be careful about restrictions and where they apply to.
See Accessing files outside the document root with Apache on StackOverflow.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.