0

I want to rename specific http get parameter since application (NextCloud) changed it from path to dir and I want to preserve compatibility with old links.

Original URL was: https://example.com/index.php/s/public?path=/Path/To/Folder

Target URL: https://example.com/index.php/s/public?dir=/Path/To/Folder

I've tried many mod_rewrite rules, best was:

RewriteCond %{QUERY_STRING} (^|&)path=([^&]+)(&|$)
RewriteRule ^/index\.php/s/public$ /index.php/s/public?dir=%2 [L,R=301]

Which relativelly worked but has problems with escaped slashes in the parameter path. For example, if link was: https://example.com/index.php/s/public?path=%2FPath%2FTo%2FFolder

it was rewrited to: https://example.com/index.php/s/public?dir=%252FPath%252FTo%252FFolder (chracter % was escaped).

Please help how to stop escaping already escaped characters. Thank you.

3
  • httpd.apache.org/docs/2.4/rewrite/flags.html#flag_ne Commented Aug 27 at 13:34
  • Thanks, but flag NE has same behavior (for this example) Commented Aug 27 at 14:24
  • Maybe the B or BNE flag then? Commented Aug 28 at 6:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.