Page 1 of 1

.htaccess rewrite problem on IBM i 7.1

Posted: Tue Aug 15, 2017 2:15 pm
by michael-linden
Hi,

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
Michael

Re: .htaccess rewrite problem on IBM i 7.1

Posted: Fri Oct 06, 2017 11:55 am
by stewartm
Michael,

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   /