R
R
Rom Black2015-03-24 10:09:23
Apache HTTP Server
Rom Black, 2015-03-24 10:09:23

Why does the server give a 404 error, but still show the requested page?

Good afternoon.
There is a site under development, the CNC is configured via mod_rewrite.
htaccess is the following:

RewriteEngine On
## add slash
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

## main rule
RewriteRule ^_dev/([^/]*)\/$ /_dev/index.php?route=$1 [L]

# blog child 
RewriteRule ^_dev/blog/([^/]*)\/$ /_dev/index.php?route=blogpost&showpost=$1 [L]

# services child 
RewriteRule ^_dev/services/([^/]*)\/$ /_dev/index.php?route=servicecat&filter=$1 [QSA,L]
RewriteRule ^_dev/services/([^/]*)/([^/]*)\/$ /_dev/index.php?route=servicepost&cat=$1&showpost=$2 [L]

At first glance, the site and the CNC work well (the desired page is given to the browser), but if you look at the console, then every request comes with a 404 server response.
[Error] Failed to load resource: the server responded with a status of 404 (Not Found ) mysite.ru/_dev/services /_dev/services/honeymoon I assume that the flags are set incorrectly, but if I specify R=301 in the rules, then when mysite.ru/_dev/services is requested, I get mysite.ru/_dev/?route=services in the URL Tell me what is my mistake.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ShamblerR, 2015-03-24
@ShamblerR

come on site.
This is usually a bug in the code.
Turn off everything on the main page piece by piece, see when the 404 disappears.
But if it no longer disappears on a clean html page, then there are really problems.
You can, as an option, put index.html and disable index.php
if, for all equal, it will give 200, then there really is a problem in the code.
ps. seen this a couple of times

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question