HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   Apache directives & front controller pattern (http://www.howtoforge.com/forums/showthread.php?t=60440)

centurianii 5th February 2013 01:08

Apache directives & front controller pattern
 
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!

falko 5th February 2013 20:19

I guess something like this should work:

Code:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]



All times are GMT +2. The time now is 23:36.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.