mod rewrite - .htaccess - 301 redirect all files without extension to have .html extension -


i need 301 redirect requests files no extension same appended .html extension:

http://www.mydomain.com/this 

to

http://www.mydomain.com/this.html 

the following not redirected:

http://www.mydomain.com/that/ (it's directory) http://www.mydomain.com/other.php 

any appreciated on above, thanks.

try following. place last rule in set (i.e. bottom) not conflict other rules.

rewritecond %{request_filename} !-d rewritecond %{request_uri} !\..+$ rewriterule ^(.*)$ /$1.html [r=301,l] 

this should ensure request not directory , doesn't end some kind of extension. if conditions met, append request .html.

this untested, comment if works. ;)


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -