I'm having trouble with my mod_rewrite rules. They are working fine, except when a .php
filename is passed in the URL. My rules are ignored in this case and I get a file not found error.
Apache 2.4 conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /srv/www/development.x.nl/x/html
ServerName development.x.nl
ErrorLog /var/log/apache2/development.x.nl-error.log
CustomLog /var/log/apache2/development.x.nl-access.log combined
Header always append X-Frame-Options SAMEORIGIN
ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php/php7.0-fpm.sock|fcgi://127.0.0.1:9000/srv/www/development.x.nl/x/html/
DirectoryIndex index.php
<Directory />
Options None
AllowOverride None
</Directory>
<Directory /srv/www/development.x.nl/x/html>
AllowOverride Authconfig Limit FileInfo Options Indexes
Options Includes MultiViews FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
.htaccess
file (which resides in /srv/www/development.x.nl/html/public
)
RewriteEngine on
RewriteRule ^([0-9]*)/(.*)$ /public/index.php [B,NE,L]
RewriteRule ^browse/([0-9]*)/(.*)$ /public/content.php?ts=$1&url=$2 [B,NE,L]
RewriteRule ^latest/(.*)$ /public/today.php?url=$1 [B,NE,L]
Example link that works fine:
http://development.x.nl/public/browse/20180103165107/http://www.aaa.nl/aanvragen-of-regelen/reizen-en-id_46991/
Link with .php
in them do not work:
http://development.x.nl/public/latest/https:/www.x.nl/document.php?m=52&fileid=83059&f=b7728857dcb2584c67189f28c24755f4&attachment=0
This used to work fine on mod_php
What am I missing here?
0 Answers