views:

19

answers:

2

I would like to translate or 301-redirect urls such as:

www.domain.com/example.html to www.domain.com/example

Here are the current rewrite rules:

   RewriteEngine On
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php/$1 [QSA,L]
   RewriteCond %{SERVER_PORT} 80 
+1  A: 

Try RewriteRule (.+)\.html$ $1 [R=301]

Bart van Heukelom
That partially worked, thank you. Is it possible to create a rule that would cause the end rewrite to be as if the .html was not there? It is interpreting the response differently.Perhaps I need to modify it to be more similar to this line, where index.php is included?RewriteRule ^(.*)$ index.php/$1 [QSA,L]
sterling
Ehm, I'm not sure what you mean. Please give some example inputs and outputs.
Bart van Heukelom
+1  A: 

Please try the following:

RewriteRule ^(.+)\.html$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L]
TonyCool