I need to 301 redirect requests to files with no extension to same with appended .html extension:
http://www.mydomain.com/this
to
http://www.mydomain.com/this.html
The following would not get redirected:
http://www.mydomain.com/开发者_Python百科that/ (it's a directory)
http://www.mydomain.com/other.php
Any help appreciated on the above, thanks.
Try the following. I would place it as the last rule in your set (i.e. the bottom) to not conflict with any other rules.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\..+$
RewriteRule ^(.*)$ /$1.html [R=301,L]
This should ensure the request is not a directory and that is doesn't end with some kind of extension. If those conditions are met, it will append the request with .html.
This is untested, so comment back if it works. ;)
加载中,请稍侯......
精彩评论