.htaccess Rewrites: add .html to wordpress posts and pages

admin

Administrator
Staff member
i want to change wordpress links from static links to .html extensions and use 301 redirect to the new links because i don't want to lose the website pages at search engines

Ex : example.com/page-name > example.com/page-name.html
: example.com/post-name > example.com/post-name.html

My code in ROOT htaccess is:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteBase /    
RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f    
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]
</IfModule>

# END WordPress