0

Is there any way to set the DirectoryIndex in Apache so that it directs to an external webpage? For example, anyone visiting mysite.com/somefolder should be redirected to google.com. I know you can just put the redirect in a file specified by the DirectoryIndex in the folder itself, but I was wondering if I could skip that step.

Thanks!

0

1 Answer 1

1

The directoryindex is either

  1. the list of default index files (index.html, index.php, default.htm, etc) or
  2. what Apache outputs when it can't find one of the above in a folder.

The Apache options for the 2nd type (at least for the versions of Apache I've used) allow you to customise the level of detail in the outout, and it could prepend a HEADER file, or append a README file. This is where you might put a redirect, also.

But I don't think there's an option for redirecting associated with the directoryindex, so the index file, or HEADER or README aren't necessary.

I usually see questions about redirecting from the .htaccess file, but I've never checked that out.

You must log in to answer this question.