login community faq

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 pages

ErrorDocument 404 /errors/404.html

ErrorDocument 500 /errors/500.html

Dump www

RewriteEngine On

Rewritebase /

RewriteCond %{HTTP_HOST} !^mysite.com$ [NC]

RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]

Remove file extensions from .html files

RewriteCond %{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 Jan 19 '12 at 05:55

wagerrard's gravatar image

wagerrard
11

edited Jan 19 '12 at 06:19


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 Jan 19 '12 at 06:18

todork's gravatar image

todork
10964

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.

(Jan 19 '12 at 06:30) wagerrard wagerrard's gravatar image

Hi again,

You can try something like this to remove the trailing slash from the URL.

(Jan 19 '12 at 07:47) todork todork's gravatar image
Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×90
×19

Asked: Jan 19 '12 at 05:55

Seen: 822 times

Last updated: Jan 19 '12 at 07:47

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited