.htaccess rewrite problem on IBM i 7.1

General discussion on Zend Server for IBM System i
Post Reply
Posts: 6
Joined: Thu Sep 16, 2010 2:36 pm

.htaccess rewrite problem on IBM i 7.1

Post by michael-linden » Tue Aug 15, 2017 2:15 pm


we are using a rewrite-rule for our zf2 project with a .htaccess file:

Code: Select all

RewriteEngine on

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ %2public [QSA,L]
This is working fine with zendsever 8.5.7 on IBM i 7.2 and IBM i7.3 systems. On IBM i 7.1 this rule is not working, we have tested it on more than on partition/installation. A system update is not possible for this machines.
Can somebody reproduce this error on IBM i 7.1 or has some ideas?

Kind Regards

Posts: 18
Joined: Thu May 17, 2012 3:14 pm
Location: Coleraine, N.Ireland

Re: .htaccess rewrite problem on IBM i 7.1

Post by stewartm » Fri Oct 06, 2017 11:55 am


I don't know much about htaccess but I can tell you the following works for me on IBM V7R1 in ZS9.1

Code: Select all

RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
RewriteBase   /

Post Reply