0

guys!

I tried to return error 404 when accessing some directories on a vhost. Let's say we have http://bla.com/bla1, http://bla.com/bla2, http://bla.com/bla3, etc waiting to be redirected to 404.

I used the following:

redirectmatch_dest      =>      ['http://bla.com/bla1', ' http://bla.com/bla2', ' http://bla.com/bla3'],
redirectmatch_status   =>      ['404', '404', '404']

But when I access the links they don't return 404. Any suggestions what is wrong here?

2 Answers2

0

I think you want to use redirect_source and redirect_status instead of redirectmatch_dest and redirectmatch_status

redirect_source => ['http://bla.com/bla1','http://bla.com/bla2','http://bla.com/bla3'],
redirect_status => ['404','404','404']

The redirectmatch* vhost parameters expect a regex. Also, your intention is to redirect from (source), not to (dest) the given URLs, hence you want redirect_source.

Jimadine
  • 141
  • 3
0

After testing a lot around redirectmatch I tried something different which is called custom_fragment which is simply importing single or lines of commands locating the at the end of the file. The second approach worked like a charm and returned successfully 404 to all subdirs.