httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fran├žois Beausoleil <>
Subject [users@httpd] Rewriting URLs to remove .html extension
Date Wed, 15 Oct 2008 16:29:39 GMT
Hi all!

I moved my blog from a CMS to plain files.  My old links are of the  

All files are now stored with a .html extension, such that


is an existing file.

I found a thread in 2004 which talked about this problem:

The URL Rewriting Guide's Canonical URLs example is also similar to  

I can't seem to make things work.  Here's my .htaccess:
# ------------------
RewriteEngine on

# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA,L]

RewriteRule ^(.*)$ $1.html [QSA,L]

# Rewrite X.html to X only
#RewriteRule ^(.*)\.html$ $1 [R=301,L]
# ------------------

I'm reading my first rule as "Rewrite / to /index.html" and end there.

My second rule is supposed to read "If there exists a file named  
X.html, rewrite to that and end", but it doesn't work.  When I ask  
for /tags/unit-testing, I get a 404.

The third rule (which is commented out) is supposed to rewrite X.html  
to X.  But when I have that enabled, requests without a .html  
extension end up in an infinite redirection loop for the 404 page.

This is hosted on DreamHost and I can't active the rewrite log.  If I  
had the log, I would probably be able to fix my problem myself!

I'm pretty sure my error is simple.  If anybody had a quick pointer,  
I'd really appreciate.

Fran├žois Beausoleil

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message