Forum Moderators: phranque
<IfModule !mod_php7.c>
AddHandler application/x-httpd-php .html .htm
</IfModule> AddHandler application/x-httpd-php5 .html .htm If your site is running php7 the line would be AddHandler application/x-httpd-php7 .html .htm or for php7.1 use AddHandler application/x-httpd-php71 .html .htm - BUT your php may be configured in some other way. If they use EasyApache CP module it would be AddHandler application/x-httpd-ea-php71 .html .php I would wait to hear from your host or consider it trial and error work.
Isn't that creating duplicated content?Well, only if the search engine discovers it. Putting a slash after html/ isn't something they try routinely, like requesting directory names with and without slash. In the requests that you posted about at the outset, are those genuine requests from legitimate search engines and/or humans, or are they things that you yourself tried experimentally?
#Remove slash after .html extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html/ /$1.html [L,R] # <- for test, for prod use [L,R=301] I know those are different things yet I don’t know how.A redirect means you are telling the visitor (browser or robot) to make a fresh request. You will see the new request in your access logs immediately after the first request. A rewrite means stuff happens behind the scenes that the visitor (again, human or robot) doesn’t know about. CMS such as WP are built entirely around rewrites. In the interest of double markedness, you may find it useful to use the phrases “external redirect” and “internal rewrite”, so long as you understand that “external” doesn’t necessarily mean go to some other site; it means “this isn’t just happening inside the server”.
the ruleset won't fire unless the requested path ends in ".html/"You meant to say “contains ".html/"” since there was no closing anchor (and rightly so). There may or may not be additional garbage after the /
RewriteCond %{REQUEST_URI} ^/([^.]+\.html)
RewriteRule \.html. https://www.example.com/%1 [R=301,L]
(Note exact position or non-position of anchors.) But now we’re getting into personal-coding-style territory.