problems on redirecting

General discussion on Zend Core for IBM System i
Post Reply
fre85
Posts: 2
Joined: Thu Apr 09, 2009 7:43 pm

problems on redirecting

Post by fre85 » Thu Apr 09, 2009 7:53 pm

Hi,

We have installed zend on our i5 and we want to try using Zend Framework. I'm following the videos from the framework site, but i'm stuck on the 3rd one. I'm working with a .htaccess file to redirect, but the redirect doesn't work. In which file do I have to enable my rewrite engine? There was a topic on the old forum (https://www.zend.com/en/forums/index.ph ... 3fa1a482d1) , but i can't contact the user or reply to the topic

Grtz,
Frederik

chris_hird
Posts: 171
Joined: Fri Apr 10, 2009 12:41 am
Location: Toronto
Contact:

Re: problems on redirecting

Post by chris_hird » Fri Apr 10, 2009 12:48 am

You need to have the rewrite module loaded, then you can use the config for the particular website you are using to determine the redirect. I use Virtual hosts so the rewrite is done in each of the virtual hosts containers. Sorry but my system is down for PTF installs etc so I cannot print my particular config.

Chris
Shield Advanced Solutions Ltd
Home of JobQGenie and the Receiver Apply Program
http://www.shield.on.ca/Blog

fre85
Posts: 2
Joined: Thu Apr 09, 2009 7:43 pm

Re: problems on redirecting

Post by fre85 » Fri Apr 10, 2009 7:18 am

the rewrite module is installed (when i look at phpinfo() it is standing there). The question is where the config-file is located and what I have to put into it?

christiand_serti_com
Posts: 31
Joined: Wed Mar 25, 2009 12:57 am

Re: problems on redirecting

Post by christiand_serti_com » Thu May 07, 2009 5:32 pm

Not sure if you found a solution.. It took me a while to figure out this and found my solution in a appache forum. Maybe it's not the same problem that I had but anyway, hope that might help!

the rewrite base directive is really important :D

RewriteEngine On
RewriteBase /myfolder
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ Index.php [NC,L]

User avatar
shlomov
Zend Global Support
Posts: 139
Joined: Mon Dec 29, 2008 2:38 pm

Re: problems on redirecting

Post by shlomov » Mon May 11, 2009 3:07 pm

The Apache module mod_rewrite is a really sophisticated module which provides a powerful way to do URL manipulations.
With it you can do nearly all types of URL manipulations, but you have to accept it’s complexity, mod_rewrite's major drawback is that it is not easy to understand and use. See Apache web site:

http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

1) The "RewriteEngine" directive enables or disables the run time rewriting engine

2) The "RewriteCond" directive defines a rule condition.
2.1) Precede a "RewriteRule" directive with one or more "RewriteCond" directives.
2.2) The rewriting rule is only used if its pattern matches the current state of the URI and if the additional conditions apply too.

3) The "RewriteRule" directive is the real rewriting mechanism.
3.1) The directive can occur more than once.
3.2) Each directive then defines one single rewriting rule.
3.3) The definition order of these rules is important, because this order is used when applying the rules at run-time.

Example:

Reverse Proxy requests for PHP scripts.

Changing the Reverse Proxy configuration ‘/www/zendcore/conf’ listening on port 89, using mod_rewrite commands:

1. First set on the RewriteEngine
2. The RewriteCondition says to only apply the RewriteRule if the requested URI ends with ".php" ([NC] = not case sensitive).
3. The RewriteRule says to pass the request to the PASE server using the ProxyPass [P].

Rewrite Settings:

ProxyPreserveHost On
RewriteEngine on .
RewriteCond %{REQUEST_URI} ^.+\.php$ [NC]
RewriteRule ^/(.*) http://127.0.0.1:8000/Development/$1 [P]
ProxyPassReverse / http://127.0.0.1:8000/ Development /


If in case, another directory name is used, than we need to fix the document root in the Apache configuration at port 89 ‘/www/zendcore/conf/httpd.conf’:

Replace this:
DocumentRoot /www/zendcore/htdocs
With this:
DocumentRoot /www/Development/htdocs

And, replace this:
<Directory /www/zendcore/htdocs>
With this:
<Directory /www/ Development /htdocs>
Shlomo Vanunu
IBM System i

Post Reply