[opencms-dev] handle404 appears on every 404 page within the export folder

Graeme Kidd coolkidd3 at hotmail.com
Wed Aug 25 18:24:21 CEST 2010


Hi,

I am using the "CmsOnDemandStaticExportHandler" Static Export Handler which requires the following mod_rewrite configuration:
RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
RewriteRule .* http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

This all works fine when the resource doesn’t exist but is still to be exported, what I find annoying however is when the file really doesn't exist. As it causes the 404 page to say this within the export directory:
"The requested resource "/handle404" was not found on the server."

So for example you could have:
http://www.test.com/export/doesnotexist.gif

Then instead of saying:
The requested resource "/export/doesnotexist.gif" was not found on the server.

It says:
The requested resource "/handle404" was not found on the server.

I have tried changing the line to "request.getRequestURL()" and "request.getServletPath()" but they both return a path that includes handle404.

The only way round this I can think of would be to use JavaScript in the handle404.jsp page e.g.
"document.location.href"

If that is the best solution then might I suggest that a future improvement would be to detect if the file really doesn’t exist and return the URI to its original location.

Thanks, 
Graeme

 

 		 	   		  


More information about the opencms-dev mailing list