Question

I have a site like:

http://*mysite.com/search/

in it index.php is generating History.pushState() for history.js

so it looks like:

http://*mysite.com/search/var1-var2-var3.html (html5)
http://*mysite.com/search/#var1-var2-var3.html&_suid=** (html4)

problem is: how to create a rewrite rule for html4 version of the link, is it possibile with this hash key?

html5 rewrite rule looks like this:

RewriteRule ^([^-]+)-([^-]+)-([^-]+).html$ index.php?var1=$1&var2=$2&var3=$3 [L]
Était-ce utile?

La solution

Not, it's not possible to use this hash key in mod_rewrite.

mod_rewrite will be of no help to capture those vars in html4 html, because everything after the hash mark won't be sent to the server. If you change just the hash mark and keep the same url before the hash mark, the server won't even be hit.

So, you need to parse this part of the url using javascript and then send your hit through ajax. The url sent to the server can be the same for html4 and html5.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top