0

I use urlencode to generate a URL. The URLs that contain either / or ( or ) will be broken. Here is the rule I use it in the .htaccess file:

RewriteRule ^([\s\S]*)$ index.php?rt=$1 [L,B,QSA]

And here is an example of a encoded (which is broken) URL:

https://lamtakam.test/law/diagnostic_assembly/134838/%D9%82%D8%A7%D9%86%D9%88%D9%86+%D8%A7%D8%B5%D9%84%D8%A7%D8%AD+%D8%A8%D9%86%D8%AF%28%D9%88%29+%D9%85%D8%A7%D8%AF%D9%87%281%29+%D9%82%D8%A7%D9%86%D9%88%D9%86+%D8%A8%D8%B1%D9%86%D8%A7%D9%85%D9%87+%DA%86%D9%87%D8%A7%D8%B1%D9%85+%D8%AA%D9%88%D8%B3%D8%B9%D9%87+%D8%A7%D9%82%D8%AA%D8%B5%D8%A7%D8%AF%DB%8C%D8%8C+%D8%A7%D8%AC%D8%AA%D9%85%D8%A7%D8%B9%DB%8C+%D9%88+%D9%81%D8%B1%D9%87%D9%86%DA%AF%DB%8C+%D8%AC%D9%85%D9%87%D9%88%D8%B1%DB%8C+%D8%A7%D8%B3%D9%84%D8%A7%D9%85%DB%8C+%D8%A7%DB%8C%D8%B1%D8%A7%D9%86+%D9%88+%D8%AC%D8%AF%D8%A7%D9%88%D9%84+%D9%85%D8%B1%D8%A8%D9%88%D8%B7+%D9%88+%D8%A7%D8%AE%D8%AA%D8%B5%D8%A7%D8%B5+%D9%85%D8%B9%D8%A7%D8%AF%D9%84+%D8%AA%D8%A7+%D8%AF%D9%88%DB%8C%D8%B3%D8%AA+%D9%88+%D9%BE%D9%86%D8%AC%D8%A7%D9%87+%D9%85%DB%8C%D9%84%DB%8C%D9%88%D9%86+%28250.000.000%29%D8%AF%D9%84%D8%A7%D8%B1+%D8%A8%D8%B1%D8%A7%DB%8C+%D9%85%D8%A7%D9%87%D9%88%D8%A7%D8%B1%D9%87+%D8%B3%D8%A7%D8%B2%D9%85%D8%A7%D9%86+%D8%B5%D8%AF%D8%A7+%D9%88+%D8%B3%DB%8C%D9%85%D8%A7%DB%8C+%D8%AC%D9%85%D9%87%D9%88%D8%B1%DB%8C+%D8%A7%D8%B3%D9%84%D8%A7%D9%85%DB%8C+%D8%A7%DB%8C%D8%B1%D8%A7%D9%86+%D9%85%D8%B5%D9%88%D8%A8+%D8%AC%D9%84%D8%B3%D9%87+%D8%B9%D9%84%D9%86%DB%8C+%D9%85%D9%88%D8%B1%D8%AE+25%2F1%2F1387+%D9%85%D8%AC%D9%84%D8%B3

It throws:

enter image description here

Any idea how can I fix it?

Andy Lester
  • 91,102
  • 13
  • 100
  • 152
Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • 1
    The Apache module doing the rewriting is called mod_rewrite and there's an entire tag here on StackOverflow devoted to it that might be helpful. [tag:mod-rewrite] – Andy Lester Nov 08 '18 at 14:33
  • Can you post your full .htaccess and a sample URL that is causing this 404 – anubhava Nov 08 '18 at 14:47
  • @anubhava [here](https://gist.github.com/sajadshafizadeh/4fc055a2f86ad85f7ae8d372d913d8c6) is the full content of `.htaccess` file and a sample URL (404) exists in my question. – Martin AJ Nov 08 '18 at 14:55
  • I checked your URL and it contains `%2F` character that results in 404 by default. You should check this question for details: https://stackoverflow.com/questions/9206835/2f-in-url-breaks-and-does-not-reference-to-the-php-file-required – anubhava Nov 08 '18 at 14:58

1 Answers1

0

You need to escape the slashes using %2F (ASCII encoding) %28 for ( and %29 for )

noid
  • 106
  • 6