I'm trying to issue a redirect where the destination contains a fragment-identifier part. I tried with this rule:
RewriteRule ^/foo/bar/([^/]+)/(.*)$ /cgi/script#foobar::$1.$2 [R,L]
However the #
is converted into %23
and the web application cannot correctly parse this url. How can I force apache to keep the #
character ?
RewriteRule "\.exe" "-" [F] This example uses the "-" syntax for the rewrite target, which means that the requested URI is not modified. There's no reason to rewrite to another URI, if you're going to forbid the request.
In your rewrite, the ^ signifies the start of the string, the (. *) says to match anything, and the $ signifies the end of the string. So, basically, it's saying grab everything from the start to the end of the string and assign that value to $1.
A rewrite rule can be invoked in httpd. conf or in . htaccess . The path generated by a rewrite rule can include a query string, or can lead to internal sub-processing, external request redirection, or internal proxy throughput.
QSA means that if there's a query string passed with the original URL, it will be appended to the rewrite ( olle? p=1 will be rewritten as index.
Solution found: there is an option for not escaping urls with mod_rewrite:
https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne
Adding the [NE] flag solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With