1

I'm looking for a way to redirect any url I visit on my computer (Mac), say www.example1.com/a/b/[\d]+, to another url www.example2.com/a/[\d]+. I don't want this to be on the IP level, just for that particular URL matched by a regular expression.

/etc/hosts was my first idea, but unsure how to do the regex match to capture the numbers and pass it to the second URL defined.

1 Answer 1

4

You can't do this in a hosts file as it is purely an IP-to-name mapping. It either needs to be done on the web server, or on a proxy server.

Apache will allow you do to this with mod_rewrite and Squid will allow you to do it with redirectors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .