admin管理员组

文章数量:1279206

I want to add 'rewrite condition' in .htcaccess but unfortunately I don't have access of that. Can I write conditions in functions.php ? If yes, how to achieve that ? I want to add these lines:

RewriteCond %{QUERY_STRING} ^.{1000,}$
RewriteRule ^wp-admin/load-scripts\.php$ - [F]

I want to add 'rewrite condition' in .htcaccess but unfortunately I don't have access of that. Can I write conditions in functions.php ? If yes, how to achieve that ? I want to add these lines:

RewriteCond %{QUERY_STRING} ^.{1000,}$
RewriteRule ^wp-admin/load-scripts\.php$ - [F]
Share Improve this question edited Sep 22, 2021 at 13:02 Ricky asked Sep 22, 2021 at 8:53 RickyRicky 538 bronze badges 8
  • Aside: The directives as posted don't quite make sense. The solitary f at the end should be [F]. Is the RewriteRule pattern intentionally uppercase? – MrWhite Commented Sep 22, 2021 at 9:40
  • ref- hackerone/reports/925425 – Ricky Commented Sep 22, 2021 at 9:44
  • Ok, but that rule is certainly wrong. It should read RewriteRule ^wp-admin/load-scripts\.php$ - [NC,F]. The rule as written (all uppercase and no NC flag) would fail to match the request it is trying to block. The NC flag would be required if you are running this on a Windows platform. And the lone f at the end would trigger an immediate 500 Internal Server Error (since it's entirely invalid syntax). – MrWhite Commented Sep 22, 2021 at 12:09
  • ok, thanks!! do u know how to achieve that via functions or any php code? I have edited my code – Ricky Commented Sep 22, 2021 at 12:57
  • 1 I'm not sure sorry. Whatever code you add, it needs to still edit the .htaccess file. If you don't have permission to edit .htaccess (or there is no .htaccess) file then this isn't going to be possible. (Has this vulnerability not already been "fixed" in load-scripts.php?) – MrWhite Commented Sep 22, 2021 at 13:36
 |  Show 3 more comments

1 Answer 1

Reset to default 1

use this https://wordpress/plugins/wp-htaccess-editor/, if you are not willing to use any plugin, understand the code and implement in functions.php or your own custom plugin. cheers.

本文标签: Can I write 39RewriteCond39 using 39functionsphp39