3

I'm trying to set up a Zend Framework 2 environment without success. I've been following these instructions:

http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html

The one difference is that I'm trying to install it on a Virtual Directory. an example URL would be:

http://localhost/12345678/index/index

I've got to the "Welcome to Zend Framework 2" page by typing:

http://localhost/12345678/index.php/

For some reason that slash at the end is important, otherwise the page won't load and I've no idea why? I would expect the following link to work but it doesn't:

http://localhost/12345678/

Because we have no choice but to use IIS 6, I'm trying to use the Ionics Rewrite filter on the URL, without success. What I've tried so far is:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [NC,L]
and
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(\d*)/(.*) /$1/index.php/ [L,QSA]
and
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ /12345678/index.php/ [NC,L]

I seem to be able to get to the welcome page and generic 404 error page (not the Zend 404). I can't get to a test controller page or even a zend error page. Can anyone help me find out what RewriteRule to use with the Ionics IIRF.ini file that will allow me to use Zend Framework 2 with virtual directories or point me in the direction of what I'm doing wrong?

Thanks in advance!!!

I've fixed my issue by starting again and following this tutorial, leaving out the Apache stuff:

http://samminds.com/2012/07/zend-framework-2-installation-on-xampp-for-windows/

I'm not entirely sure why it's working but IIS seems to be reading the .htaccess file which is great. Of coarse this has lead me on to other issues but this one is resolved for me :). I have not answered my own question with this because I don't feel that what I have done is a proper solution to my problem.

richie
  • 781
  • 2
  • 11
  • 24

1 Answers1

0

Did you take a look at the ISAPI Rewrite module bij Helicon? It supports Apache mod_rewrite rules syntax. I used this module in the past with ZF 1 and it worked like a charm. There's a free version available which has some limitations: http://www.helicontech.com/download-isapi_rewrite3.htm

Ruben
  • 5,043
  • 2
  • 25
  • 49
  • Thanks for the suggestion. I've tried installing Helicon and I'm still getting the same issues. I feel that the fact that I can't access http://localhost/12345678/index.php and I can access http://localhost/12345678/index.php/ is key to finding out where my issue is. – richie Jun 10 '13 at 11:04
  • What does your new htaccess file look like, because the first one in your original question doesnt seem to make a lot of sense and is not what the standard htaccess file of a zf2 application looks like. Did you use the htaccess that ships with the skeleton application? – Ruben Jun 10 '13 at 17:04
  • I left it as the default that comes with the template which is: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ RewriteRule ^(.*) - [E=BASE:%1] RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L] – richie Jun 11 '13 at 09:01
  • Okay and just to make sure: your virtual directory is pointing to the public folder, correct? – Ruben Jun 11 '13 at 20:27
  • good call but it is. if it wasn't I wouldn't be able to access localhost/12345678/index.php/ which I can, but I can't access localhost/12345678/index.php – richie Jun 12 '13 at 09:06