Copy link to clipboard
Copied
Hi,
When I edit .htaccess file and put these codes into .htaccess file(To remove .html) its worked but only for index page.
Question 1).
How can I remove .html for all pages?
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . %1 [R=301,NE,L]
# Begin Muse Generated redirects
# End Muse Generated redirects
When I added additional codes for Http to https got warning please see the attached
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . %1 [R=301,NE,L]
# Begin Muse Generated redirects
# End Muse Generated redirects
Question 2).
How can I fix both problems?
Thanks.
I have branched this to a new topic because your question is more complicated than the original thread from 2 years ago.
Obviously this question has noting to do with Muse. .htaccess is a server file. Does your hosting plan include C-Panel? If so, that's the easiest way to edit your .htaccess file. See links below.
Removing file extensions.
https://www.plothost.com/kb/how-to-remove-php-html-extensions-with-htaccess/
Rewrite HTTP to HTTPS
https://www.name.com/support/articles/115005296088-Redirect-HTTP-to-HTTPS-automatically
...Copy link to clipboard
Copied
I have branched this to a new topic because your question is more complicated than the original thread from 2 years ago.
Obviously this question has noting to do with Muse. .htaccess is a server file. Does your hosting plan include C-Panel? If so, that's the easiest way to edit your .htaccess file. See links below.
Removing file extensions.
https://www.plothost.com/kb/how-to-remove-php-html-extensions-with-htaccess/
Rewrite HTTP to HTTPS
https://www.name.com/support/articles/115005296088-Redirect-HTTP-to-HTTPS-automatically
NOTE: do NOT duplicate RewriteEngine On. When it's on, it's on.
Copy link to clipboard
Copied
hi,
can you please send me that how to use both in one htaccess file
like one is http to https redirect
and second is hide .html file extension
please reply
Copy link to clipboard
Copied
This is NOT a Muse question. It's a server configuration question. Each hosting plan is different. Some hosts support .htaccess and others don't. Please contact your hosting provider for assistance.
Copy link to clipboard
Copied
thanks for quick response, yes my hosting is supporting .htaccess file and its already working fine for http to https redirection, but i want to add in that file for .html extension hide code
RewriteEngine On
RewriteCond %{HTTP_HOST} ^growtele\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.hostname.com/$1 [R,L]
Copy link to clipboard
Copied
See explanation below.
https://www.plothost.com/kb/how-to-remove-php-html-extensions-with-htaccess/
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Show us what you have currently.
Copy link to clipboard
Copied
## Strip www from URLs ##
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
## Strip .html from URLs ##
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
## Rewrite http to https ##
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
## If needed, add extra conditions here... ##
Failing that, check your code's syntax below or contact your hosting provider.
Copy link to clipboard
Copied
my code is below, but .html extension not hide, here my code
## Strip .html from URLs ##
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
## Rewrite http to https ##
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
[L,R=301]
Copy link to clipboard
Copied
Please contact your host. It's possible your server is not configured to allow it.
Copy link to clipboard
Copied
Nancy Oshea,
Thanks for your quick response. Yes, I have access to cPanel and I replace those codes instead of my previous codes but not working. So I decided to keep my previous codes because something is better than nothing. My previous codes working for the index page.
Thanks, Kashem.