Is it possible use mod_rewrite to resolve addresses hosted on another server?
Say I want to setup this URL:
http://www.myserver.com/myfolder/
To actually resolve to:
http://www.anotherserver.com/anotherfolder/
If so, could you provide a RewriteRule example?
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.
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.
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.
You can use the P flag in a mod_rewrite rule to get that substitution URL requested by mod_proxy:
RewriteEngine on
RewriteRule ^myfolder/$ http://other.example.com/anotherfolder/ [P]
Now when a client is requesting /myfolder/
from your server, it will request http://other.example.com/anotherfolder/
and send the response from that server back to the client.
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