M
M
Magzhan Birgebayuly2015-10-15 12:07:11
PHP
Magzhan Birgebayuly, 2015-10-15 12:07:11

How to make it so that Ajax does not swear at non-existing pages or .htaccess accept requests even if the page does not exist?

If the page doesn't exist, Ajax immediately responds with an error.
Where, what to add - what would Ajax send requests ignoring errors or .htaccess would answer "everything is fine"?

For example: Index.php still receives a request with addresses ' /pages/news ', because .htaccess says - " if there is no page, forward requests to the main page ". ps Excuse my French... brains are boiling >.<
$.ajax({ url: '/pages/news' })



Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-10-15
@NeiroNx

Set up ModRewrite - so that PHP decides what needs to be returned and not Apache.
settings are mostly standard - can be found on the Internet.
the bottom line is that requests like site.ru/pages/news turn into site.ru/script.php?q=pages/news
And the script displays the corresponding data or an error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question