Current folder/fie structure:
domainname.com/blog/2019/june/this-is-one-blog-title/
The URL to the blog post would be domainname.com/blog/2019/june/this-is-one-blog-title/index.html
, but we are using an .htaccess Rewrite Condition/Rule to remove the “index.html” as well as updated the meta canonical structure in the <head>
.
What I need:
domainname.com/blog/this-is-one-blog-title/
However, when I moved the ‘index.html’ to domainname.com/blog/this-is-one-blog-title/
and renamed that file to “this-is-one-blog-title.html”, I get an Error 404 when I test it.
This doesn’t seem logical to get an Error 404 if I moved the file to a different location, renamed it and changed the URL access. It should be appearing. Make sense?
The only thing I can think of is there’s something wrong with my Rewrite/Condition Rules. I don’t want any trailing “index.html” or “index.php”, and the below code does the job, but I’m wondering if it’s affecting my attempts to load the new file structure:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*/)?index(\.php|\.html)?(\?.*)?\ HTTP/
RewriteRule .? /%1 [R=301,L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)\.(php|html)(\?.*)?\ HTTP/
RewriteRule .? /%1 [R=301,L,QSA]
Thank you for your time.