Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 5th February 2013, 01:08
centurianii centurianii is offline
Junior Member
 
Join Date: Mar 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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!
Reply With Quote
Sponsored Links
  #2  
Old 5th February 2013, 20:19
falko falko is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
 
Default

I guess something like this should work:

Code:
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Tags
ajax, apache directives, url rewriting

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sessions not being saved gavimobile General 6 15th January 2012 15:05
Apache hangs without traffic Thesee General 21 27th September 2011 23:43
local ip:8080 just downloads a file called download or index.php dr_patso Installation/Configuration 5 20th September 2011 20:54
SSL don't work please help me walner8080 Installation/Configuration 8 26th September 2010 12:07
problems with suexec gobokster Installation/Configuration 7 7th May 2009 13:33


All times are GMT +2. The time now is 13:04.


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