I use webspace and have some html files on the webspace. For example the XY.html file.
When I call up domain.com/xy a 404 comes up. I always have to enter domain.com/xy.html.
Would you like to set that all .html files can also be called without .html?
Current .htaccess
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
I've already tried the following, but unfortunately it doesn't work.
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
What can I do? Thanks!
You can use this :
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
#remove .html
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^([^./]+)/?$ $1.html [L]
#rewrite non-existent requests to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]