0

I have an existing htaccess-file that redirects to a subfolder. It is necessary to have an trailing slash.

I have add a rule that redirects to an url with a trailing slash, but since then the other rules are never met.

RewriteEngine On

RewriteRule ^(.*)$ /$1/ [C,R=302] #301 when everything works fine :)

RewriteRule ^app/(.*)$  webapp/PNJ/client/frontend/$1  [QSA,L]
RewriteRule ^pnj_be/(.*)$  webapp/PNJ/client/backend/$1  [QSA,L]

The C in the first rule should chain the rules, but I don't know why the rules are never met. If I write manually http://example.com/app/ the rules are accepted. If I dont't add the trailing slash, I will get redirected to the URL with the correct url, but then the browser can't find any files.

Can anyone explain why this doesn't work? Or give a hint, what the right solution is?

N.Poj
  • 37
  • 5
  • On the first `RewriteRule` try to change `RewriteRule ^(.*)$ /$1/ [C,R=302]` with `RewriteRule ^(.*[^/])$ /$1/ [C,R=302]` and see if its working. This is because you don't check if it has a tralling slash.. u enforce it eitherway. – Konstantinos Mar 23 '18 at 14:53
  • No, didn't work, still getting the same problem. – N.Poj Mar 23 '18 at 15:53

0 Answers0