1

I use PrestaShop on Litespeed server, here is a part of .htaccess of admin panel:

    # Keep legacy entry points
    RewriteRule ^(ajax|ajax_products_list|ajax-tab|backup|cron_currency_rates)\.php - [P]
    RewriteRule ^(displayImage|drawer|footer\.inc|functions|get-file-admin)\.php - [P]
    RewriteRule ^(grider|header\.inc|init|login|password|pdf|searchcron)\.php - [P]

    # If the URL is a legacy on index.php?controller=..., do not rewrite (let the legacy take it)
    RewriteCond  %{QUERY_STRING} (^|&)controller=|(^|&)tab=
    RewriteRule .* - [P]

I see many logs regarding those:

2021-10-30 16:01:17.163186  WARN    [225891] [T0] [REWRITE] Detects bad proxy action without updating target URL. Ignore. while parsing: RewriteRule ^(ajax|ajax_products_list|ajax-tab|backup|cron_currency_rates)\.php - [P]
2021-10-30 16:01:17.163218  WARN    [225891] [T0] [REWRITE] Detects bad proxy action without updating target URL. Ignore. while parsing: RewriteRule ^(displayImage|drawer|footer\.inc|functions|get-file-admin)\.php - [P]
2021-10-30 16:01:17.163228  WARN    [225891] [T0] [REWRITE] Detects bad proxy action without updating target URL. Ignore. while parsing: RewriteRule ^(grider|header\.inc|init|login|password|pdf|searchcron)\.php - [P]
2021-10-30 16:01:17.163243  WARN    [225891] [T0] [REWRITE] Detects bad proxy action without updating target URL. Ignore. while parsing: RewriteRule .* - [P]
2021-10-30 16:01:17.581695  WARN    [225890] [T0] [REWRITE] Detects bad proxy action without updating target URL. Ignore. while parsing: RewriteRule .* - [P]

Can anyone describe what are those RewriteRules and why I get those errors?


Thanks!

  • `RewriteRule .* - [P]` P flag requires pattern target , you only have one like , it should be `RewriteRule foo bar [P]` https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_p – qtwrk Oct 30 '21 at 13:56
  • 1
    @qtwrk Although it is the use of the `P` flag itself that is the error here. – MrWhite Oct 30 '21 at 17:30

1 Answers1

2

The use of the P flag is clearly an error in this context. I would have said it was a typo, was it not on every rule! They probably meant to use PT (passthrough), although L (last) (or END) would be preferable.

The purpose of these directives is to prevent further processing (ie. other rewrites from occurring) of these particular "legacy" URLs.

Change [P] to [L] on all 4 of these rules to resolve this.

For example:

RewriteRule ^ - [L]

(Also changing .* to ^ on the last rule, since it doesn't need to actually match everything, it just needs to be successful for everything.)

MrWhite
  • 43,179
  • 8
  • 60
  • 84
  • just curious , what's difference between `.*` and `^` ? – qtwrk Oct 30 '21 at 17:43
  • 1
    @qtwrk Efficiency (in this context). The regex `.*` steps through the entire URL-path and matches everything, storing this in a backreference that is later accessible with `$0`. The `^` (start-of-string anchor) simply asserts the start of string. It matches nothing (no backreferences are created), but is always successful. – MrWhite Oct 30 '21 at 17:59
  • Thanks for your great answer! It was much more than enough and also learned many things about this. – Nima Masalegooha Oct 31 '21 at 11:23