I'm wondering what directives to write to my apache 2 virtual hosts so as to start using a design based on the front controller pattern. To be more precise, my ajax requests would update the url hash fragment resulting in urls shown to user as: Code: http://www.mysite.com/#!/path/to/data&ui=123&var=456&id=2714 containing links of the form: Code: <a id="123" href="/#!/path/to/data&ui=123&var=456&id=2714">link</a> or using the Hijax technique: Code: <a id="123" href="index.php?/path/to/data&ui=123&var=456&id=2714">link</a> (javascript handles all behavior of links) But as google instructs here the crawler will make the following request TO the server: Code: http://www.mysite.com/?_escaped_fragment_=/path/to/data&ui=123&var=456&id=2714 or using the Hijax technique (nothing new here): Code: http://www.mysite.com/index.php?/path/to/data&ui=123&var=456&id=2714 and the server SHOULD map these back to their ajax form plus a snapshot of the page! As you can see, one immediate solution comes from the front controller pattern: send all external requests of the form: Code: http://www.mysite.com/whatever/you/like to Code: http://www.mysite.com/index.php?/whatever/you/like and also force the user to see the new ajax version: Code: http://www.mysite.com/#!/whatever/you/like How can I do such generalized redirection in apache2? Thanks!
I guess something like this should work: Code: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L]