Currently I'm adding a Random Number to the end of my Ajax URLs via Javascript or PHP. I'm wondering if I could do the same just inside of my .htaccess file, when I'm rewriting them using mod_rewrite.
Is there any way to making a Random Number or String in a .htaccess file on-the-fly?
Edit: I don't have any problem in my current code. I just want to know if I could generate a random number in the .htaccess file or not. I've already searched the 'net, but couldn't find anything helpful yet.
Update: Well, I just realized that Ajax requests caches on the Client-side, but the .htaccess works on the Server-side. So, my question seems totally useless now (at least in my own case), but thanks for sharing your ideas.
I know, this is an old question as well as the fact, that the problem is somewhere else. Though, this could be something you can maybe use for other things.
The RewriteEngine knows variables, so you could use conditions or just add the %{TIME} to the call
RewriteCond %{TIME_SEC} <30
RewriteRule .* /first.html [L]
RewriteCond %{TIME_SEC} >29
RewriteRule .* /second.html [L]
You could also play around with the other variables.
You could try to use a RewriteMap with the prg MapType. This would enable you to call an external program to process the RewriteRule. And that script could do whatever you want…
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With