php - htaccess for fully ajax based site
I am making fully ajax based site. Whenever any URL hit for site, I need to load common view. So for that I made this in htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L]
And after loading common view, I am making an ajax call but because of this htaccess, ajax call again loading same view.
For example,
If anyone is requesting forwww.abc.com/dashboard
, it needs to loadindex.php
file first. And then I will be another making request for/dashboard
to get the HTML content.
In short, index.php loads the skeleton, and then I am ready to load the data from ajax.
But because of the above htaccess, it will loadindex.php
even if i will request to/dashboard
.
I am in deadlock.
More information:
I am usingjQuery
andasual address
plugin for handing change event of address.
I am usingCodeIgniter
.
Answer
Solution:
This is not related to your htaccess. You should have logic in index.php file, which would route AJAX requests differently than normal requests.
Answer
Solution:
try
in your index.php and then run the logic of mydashboard.php (or however you will call it)