Recently I have a trouble with some sources hitting my application with index.html and going for Error 404.
Is it any way possible in YII to redirect index.html to index.php ?
I tried using the .htaccess changes, but somehow it didn’t help the purpose.
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /myapp
# otherwise forward it to index.php
RewriteRule . index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1index.php [R=301,L]
Your new rewrite rules are not working because you placed them after the default ones. They make every request for a non-existent file to be redirected to index.php.
Normally those 404 errors should be a problem for you because those are probably just bots scanning the web. If you haven’t posted a link to index.html anywhere no normal users should try to open it by hand.
To fix your rewrites place the last rule right after enabling the engine, like so:
RewriteEngine on
RewriteRule ^index\.html /index.php [R=301,L]