Hello, I have some issues with an .htaccess file code... I want to: - remove the file extension from the URL - and replace it with a "/" at the end... This is my code I've added and it's not working at all! RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.htm -f RewriteRule ^(.*)$ $1.htm # Replace htm with your file extension, eg: php, htm, asp # Forces a trailing slash to be added RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ RewriteRule (.*)$ /$1/ [R=301,L] Basically it should replace ".htm" with "/" It's not working at all.
Please copy and paste the following code to your .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ $1.php [L,QSA] Once this file has been uploaded to the root directory on your web server, the ".php" extension will no longer be required in your URL's to access pages.
Should be .htm, since I have .htm extensions, right? Anyway, I tried it your way with .htm instead of .php, but still doesn't work. What could the cause of the problem be? And what could the solution be?
Sorry for the inconvenience Please copy and paste the following code once in your .htaccess file, and I hope this time it will work: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html
Unfortunately it isn't working... shouldn't it also contain this? RewriteBase / Meanwhile I contacted the hoster, but they are unaware of any setting blocking this from their side