Jump to content

Advice on htacces/pushstate


joe_g
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...