Domanda

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 ?

È stato utile?

Soluzione

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{REQUEST_URI} !\.html$ [NC]
RewriteRule ^(.+?)/?$ /$1.html [L,R]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top