When i make a request "http://domain/index.php" or such "http://domain" i want the server to give me 404 code. When i make "http://domain/some-path/index.php" i want the server to give me an index file from the "some-path" directory. But server give me 404 code in all cases. There my code in htaccsess file.
RewriteEngine On
#RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{REQUEST_URI} ^/$ [OR]
RewriteCond %{REQUEST_URI} ^/index.html$
RewriteRule ^ - [L,R=404]
RewriteCond %{REQUEST_URI} ^/some-path/?$
RewriteRule ^ - [L,R=403]
RewriteRule ^some-path/(([^.]+.(html|php))|(assets/.*))$ /$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^some-path/([^/.]+)$ $1.html [L]
It seems that the line RewriteCond %{REQUEST_URI} ^/index.html$
does not work correctly.
2
Answers
This is my answer RewriteEngine On
With your shown samples and attempts please try following .htaccess rules file.