I previously made my website with WordPress. I have a few posts which seem to doing fine (SEO). The url of my posts are www.sitename.com/this-is-post-title. I have rebuilt the the site with html, and planning on moving the blog posts to blog.sitename.com so that the new url will be blog.sitename.com/this-is-post-title.
I have a created an html file as this-is-post-title.html and set the redirect to blog.sitename.com/this-is-post-title. this is the redirect code
<meta http-equiv = "refresh" content = "0; url = https://blog.sitename.com/this-is-post-title/" />
It works fine when sitename.com/this-is-post-title.html is accessed, but not when sitename.com/this-is-post-title is accessed. My previous post is also without .html since I was working in WordPress. Any help for me?
You can add this line in your .htaccess
file:
Options +Multiviews
Multiviews is a feature in Apache that will serve content from URLs without an extension by searching for similarly named files with an extension.
Alternately, you could implement redirects in .htaccess
RedirectMatch permanent ^/this-is-post-title$ /this-is-post-title.html
OR
RewriteEngine on
RewriteRule ^/this-is-post-title$ /this-is-post-title.html [R=301,L]