How to redirect all requests from /zf3/* URI to index_zf3.php file?

I am working in a slow migration from Zend Framework 1 to Zend Framework 3. Right now I need to have both working side by side so the way I found to achieve this was using an .htacess file to redirect the ZF1 requests to it’s front controller and same with ZF3 requests. So far this is what I have done:

RewriteRule ^legacy(/.*)?$ index_zf3.php [NC,L]
RewriteRule ^sw(/.*)?$ index_zf3.php [NC,L]
RewriteRule ^application(/.*)?$ index_zf3.php [NC,L]

The rules above means legacy, sw and application are being built in ZF3. The approach works but now I am moving more and more code so ZF3 URL (requests) are growing up and it means I’ll need to keep adding rules each time and I don’t want to.

Currently the directory structure is as follow:

I want to redirect all the requests going to/zf3/<any_controller_name>/<any_parameters> to index_zf3.php

What’s the right rule for achieve this?

Answer

Attribution
Source : Link , Question Author : ReynierPM , Answer Author : Community

Leave a Comment