htaccess file extensions
In the public_html folder I have 2 files:
home.html
test.html
home.html links to test.html with:
">Test
I do not want to display the .html extension in the browser.
My htaccess file is as follows, but the .html extension is still displayed:
# BEGIN GD-SSL
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^education\.mekan\-turk\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
# END GD-SSL
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
-
Hey there, I had good luck with this block of code inside an existing Wordpress site: #Redirect /filename.php to /file RewriteCond %{THE_REQUEST} \s/([^.]+)\.php [NC] RewriteRule ^ /%1 [NE,L,R] #Internally map /filename to /filename.php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L]
Can you try that?0 -
Thank you but your code is for php. I am looking for .html. The following code works on Chrome for me, but not on Safari or Firefox. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html [NC,L]0 -
I also confirmed that isn't working for me in Firefox when I tested just now. I don't have any additional code snippets to provide, although I am surprised that modifying the PHP version I provided also doesn't seem to work for html files. Perhaps another community member will add some of their thoughts here to help. 0
Please sign in to leave a comment.
Comments
3 comments