I'm setting up a static/cgi/php site (all static HTML pages, nothing else) and need some help with my .htaccess file. Here's my current .htaccess: #No directory listings Options -Indexes Custom error pagesErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html Dump wwwRewriteEngine On Rewritebase / RewriteCond %{HTTP_HOST} !^mysite.com$ [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301] Remove file extensions from .html filesRewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html But... While "mysite.com/pages/about.html" correctly displays that page, "mysite.com/pages/about.html/" displays an unstyled 404 page. (EDIT: This seems down to mangled links to the CSS file.) "mysite.com/pages/about" correctly displays that page. But "mysite.com/pages/about/" displays an "Internal Server Error" message and a note that "Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.". What am I doing wrong? asked 19 Jan '12, 05:55 wagerrard |
Hi, The unstyled 404 page shouldn't be happening unless the /errors/404.html file is missing, or if it's smaller than 512 bytes and you're using an old IE browser. If you can't figure this out, please open a ticket, and we'll take a look. Regarding removing file extensions from HTML files, there's a better way to do it - turning on MultiViews. You can do this by putting the following line in your .htaccess: Options +Multiviews answered 19 Jan '12, 06:18 todork Thanks. Bad CSS links produced the unstlyed pages. I've fixed that and edited my question to reflect it. "Options +Multiview" works fine. The "Internal Error Message" display is gone, but adding a backslash -- "mysite.com/newpost/" or "mysite.com/pages/about/" brings up a 404. I want the backslash to disappear and the correct page to display. Off to figure that out.
(19 Jan '12, 06:30)
wagerrard
|