0

This is in the configuration file of "this.com":

RedirectMatch 301 ^/dham/(.*)$ http://other.com/dham/$1

Server is restarted. Then I curl an address that should match:

~$ curl http://this.com/dham/abc
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>

Why doesn't it work? And yes, the server reads this config file (I confirmed this by deliberately misspelling the directive, which caused an error on restart). I would have expected a redirect message.

[EDIT] This simpler approach also doesn't work:

Redirect 301 /dham http://other.com/dham

Further working straight from the documentation. This works even less, the server doesn't start and gives an error message about a missing target URL. The documentation clearly shows that within a location block, only the target URL is required (because the source is of course known from the Location). I'm running Apache 2.4.

<Location "/dham">
    Redirect 303 "http://other.com/dham"
</Location>

1 Answer 1

0

Turns out what I don't understand is that directives in an alphabetically "later" conf file will take precedence over an earlier one. The documentation says the files are processed in alphabetical order which I had taken to mean that an incoming request is checked against the directives in the order of the files.

Soo ... I took out the other file and all is fine.

You must log in to answer this question.

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