joe_g Posted March 10, 2014 Posted March 10, 2014 I'm trying to write a site where all urls/routing happens client-side via pushstate/popstate (I'm a bit new to pushstate). My problem is how to separate client side request and server side requests. Ideally I'd like to use the same structure for both client side and server side, like: 1. access /url 2. with htaccess rewrite / is served - (SPA app-style) 3. my JS loads /url and shows it This way I can use a $page->url like it's a classic server side site. One solution is to add ?ajax=true to all ajax calls and let RewriteCond pass these through (http://stackoverflow.com/questions/10708273/redirect-ajax-query-by-htaccess) Another solution would be to put all server side content in a separate folder somehow I'm not sure what would be the cleanest most future-proof way of doing this, maybe someone else did this and have some insights? thanks! J
joe_g Posted March 10, 2014 Author Posted March 10, 2014 sweet thanks, all i have to do is if(!$config->ajax) { echo $pages->get('/')->render(); } else { ...stuff } ..no fiddling with .htaccess
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now