views:

64

answers:

2

I want to link to a plain html page from a zend_controller controlled page. I have no idea how to do this.I have tried with 'redirect(site/somedir/some.html)' but, of course, that doesn't work. thank you

the html file is located in the public directory of the site = zf-site/public

A: 

In your action controller you can do this with:

$this->_redirect('site/somedir/some.html');

But you need also make sure that this some.html is located somewhere in your document root and accessible through web, where all your view scripts are probably above it. In this case if you put this static HTML file into the same folder as other view scripts are - this will not work...

Laimoncijus
Thank you Laimoncijus and Pekka. It works! The problem is that from that html page I link to other html pages and zfw treats the requests as zfw requests and, of course, tells me that the controller specified(the name of the subfolder where the other html pages are located) is not valid. What I need is to override the front controller default behaviour and make it take those requests as plain html requests.
curro
Laimoncijus, your solution works if the html page is located in the public directory, if you want to access subdirectories you get an 'invalid controller specified(somedir)'exception.
curro
A: 

Reply to comments:

 RewriteEngine on
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

Using the 3rd and 4th line says to not redirect if file or directory exists. You can these 2 lines to your .htaccess file and your .html will be served as normal.

smack0007
It definitely works!Thank you, smack0007. After several tries giving some problems I finally got it working substituting my .htaccess last line for the one you posted !\.(js|....
curro
I have tried to give points to this answer but it seems I have a very bad reputation ;-)Thank u again smack
curro