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, it needs to loadindex.php file first. And then I will be another making request for/dashboardto 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.




This is not related to your htaccess. You should have logic in index.php file, which would route AJAX requests differently than normal requests.






in your index.php and then run the logic of mydashboard.php (or however you will call it)

People are also looking for solutions to the problem: copy files from one server to another using php


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.