A
A
Arthur2018-07-25 15:12:53
Apache HTTP Server
Arthur, 2018-07-25 15:12:53

How to remove .html from the end of url in WP?

Tried this one:

RewriteEngine On
RewriteCond %{REQUEST_URI} ! \.html$
RewriteCond %{REQUEST_URI} ! /$
RewriteRule ^(.*)$ $1.html

but it gives a 500 error.
Any other options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Kunitsyn, 2018-07-25
@arturweb01

In .htaccess file write
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ DOMEN.COM/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html
*Where your domain.com is

O
Orkhan Hasanli, 2018-07-25
@azerphoenix

In the admin panel
Settings - Permalinks - Arbitrary (custom) permalinks,
select the structure and delete at the end of .html
for example,
/%category%/postname%/
or
/postname%/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question