1

I have some old html pages that have SSI includes in them to include certain html in all the pages.

So, the SSI looks something like this:

<!--#include virtual="/includes/noNav/footercode.html"-->

But I want to move that included file from /includes/noNav/footercode.html to /includes/footercode.html so I implemented a redirect in an .htaccess file like this:

# Redirect permanent /includes/noNav/footercode.html  http://intranet.myorg.org/includes/footercode.html

But now I get errors saying "unable to include "/includes/noNav/footercode.html" in parsed file" So, do redirects not work on included files?

Also, if I browse directly to the old path, it will correctly redirect me. But it fails if the path is included.

kidbrax
  • 113
  • 6

2 Answers2

3

The SSI is parsed as part of the apache SSI module and does not make web requests back to Apache in order to retrieve the file. As it does not use HTTP back to Apache to retrieve the files specified by #include, no rewrite or redirect rules are applied.

The virtual= directive finds a file starting at ServerRoot, while the file= directive finds a file in the same directory as the current page.

Kyle Smith
  • 9,563
  • 1
  • 30
  • 32
0

What you are trying to accomplish can actually be done via rewrites (with mod_rewrite) as opposed to a redirect. Your .htaccess should be changed to:

RewriteRule /includes/noNav/footercode.html   /includes/footercode.html

The file will still be accessible as /includes/noNav/footercode.html but the content of /includes/footercode.html will be served. Be aware that you need to enable rewrites if you haven't already done so:

RewriteEngine on

And that some variables might have their names changed to prepend REDIRECT_ to the name.

insaner
  • 151
  • 3