Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding encoded chars to the url breaks htaccess

Here's my code:

RewriteEngine on
RewriteRule page/(.*) index.php?url=$1 [NC]

When I access page/http://google.com/ = works just fine
When I access page/http%3A%2F%2Fgoogle.com%2F = server reports 404

Martti Laine

like image 284
Martti Laine Avatar asked Dec 15 '25 20:12

Martti Laine


1 Answers

I believe you need the B (escape) flag:

RewriteRule page/(.*) index.php?url=$1 [NC,B]

That will escape the back-reference ($1) before adding it to the replace string.

like image 154
Matthew Flaschen Avatar answered Dec 18 '25 03:12

Matthew Flaschen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!