Question

I'm working with html5 pushState(), but if i wanna load the site by a pushState URL it returns 404.

Therefore i need to rewrite all /somePushStateURL to /somePushStateURL.html to get to the right site.

How the right htaccess entry will look like ? Are there some other solutions for my problem ?

Was it helpful?

Solution

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{REQUEST_URI} !\.html$ [NC]
RewriteRule ^(.+?)/?$ /$1.html [L,R]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top