'My godaddy linux host is kinda blocking my htaccess file [closed]
I have a linux shared hosting account with GoDaddy, and I've tried the following to hide my html extension from my website:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
It didn't work, so I contacted support, they said it was because of the htaccess file and that the hosting wasn't blocking the htaccess file, so I tried this:
Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Also, I tried adding DirectoryIndex custom.html to have a unique index file name, but it didn't work, so is there any other way to do it? I just want to hide html file extensions. I also tried adding DirectoryIndex custom.html to have a unique index file name, but it didn't work. Only index.html is acceptable.
Solution 1:[1]
So basically the problem was from the server and the support solve it so now my htaccess is as the following :
Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pavel Ants |
