Using .htaccess To Append .html Behind Url Path
People are coming into my website like this: sitename.com/brands/brandA But this will cause an 404 error because I actually need them to come to this url sitename.com/brands/brandA
Solution 1:
why don't you try this.
RewriteEngine On
RewriteRule ^/brands/(.*)$ /brands/$1.html [L]
Solution 2:
You can use mod_negotiation for this, too:
<IfModulemod_negotiation.c>
Options +MultiViews
</IfModule>
If a request comes in, that would result in a 404, mod_negotiation takes other headers like the Accept
into account and looks for files with the same base name but appropriate extensions.
Post a Comment for "Using .htaccess To Append .html Behind Url Path"