You are here: Re: .htaccess - htm / html question « HTML « IT news, forums, messages
Re: .htaccess - htm / html question

Posted by nllamas on 04/02/06 01:19

"Steven" <Phelum@Syd.au> wrote in message
news:1stt22pi3brk5sjt4vcit8135neq935q6u@4ax.com...
> On Sat, 01 Apr 2006 21:49:21 GMT, "nllamas" <nospam@hotmail.com> wrote:
>
>>Checking my error logs, today, I find that some people are occasionally
>>requesting pages with an .htm extension rather than .html
>>Not sure why this is - all my pages have always ended in .html.
>>
>>Anyway, is there something I can put in my .htaccess file to direct
>>requests
>>for .htm pages to the correct .html file.
>
> I think RewriteCond and RewriteRule will do what you want but offhand I
> can't say exactly what to put in .htaccess as I haven't done it.
>
> Here is an example from one of my directories :
>
> # If no filename, use index.htm
> # If file missing, redirect (permanent) to Exetel
>
> RewriteEngine on
> RewriteRule ^$ index.htm [L]
> RewriteCond %{SCRIPT_FILENAME} !-f
> RewriteRule ^(.*)$ http://home.exetel.com.au/phelum/$1 [R=301,L]
>
> I referred to the documentation at httpd.apache.org. Hopefully there
> will be an example there for what you want.
>
> --
> Steven

Thanks Steven!
I followed your suggestion and after a bit of hunting around I found:

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.htm$ $1.html [R=permanent]

and it does just the trick.

Thanks again!
nllamas

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация