5

I'm using the standard Zend /public/.htaccess file (shown below).

At the moment I'm attempting to forward the user to a specific controller/action, and supply the on-success-redirect URL as a URL parameter.

The resulting URL (assembled & encoded via Zend's URL view helper) looks like this:

localhost/crop/index/successRedirect/localhost%2Fprofile%2Fbasic

However this pattern apparently violates the default, Zend package mod_rewrite rules: accessing the URL yields a standard Apache 404 error; Zend doesn't receive the request.

When the final parameter is manually re-formed as follows, the request works as desired:

localhost/crop/index/?successRedirect=localhost%2Fprofile%2Fbasic

However this requires a hackish, two-step URL generation process. It would be ideal if the URL produced by the view helper worked independently.

What can be done to permit the url-encoding to pass through? Any insight would be appreciated!

These are the contents of my .htaccess

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

Enabling RewriteLog like so produces no output for the failing pattern:

RewriteLogLevel 9
RewriteLog "<path>/rewrite.log"

I've attempted the solutions proposed by the following two Q&A's, with no change:

Community
  • 1
  • 1
Daniel B.
  • 1,650
  • 1
  • 19
  • 40
  • This proposed solution also had no effect: http://stackoverflow.com/questions/6520484/mod-rewrite-urlencoding-an-already-urlencoded-querystring-parameter-any-way-to - add `NE` directive to `RewriteRule` – Daniel B. Feb 02 '12 at 22:11

1 Answers1

4

AllowEncodedSlashes On fixed this for me, using your exact test URL. However as per http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes, this directive needs to be in either the server configuration or vhost. it doesn't work in the .htaccess file.

Personally I would go with the query string solution. Could you expand on what you mean by this being a two-step URL generation process? I would have thought the syntax would be pretty similar to using the normal URL helper.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
  • Sure enough. Setting this directive in `/etc/apache2/apache2.conf` - my original attempt - had no effect. I just tried setting it in the virtual host (`/etc/apache2/sites-available/default`) and it was successful. Thanks! – Daniel B. Feb 02 '12 at 23:52