Mobile app version of vmapp.org
Login or Join
Alves908

: How to fix this 404 soft error? I have a static HTML website. www.example.com/?12345 (this page doesn't exist) redirects to www.example.com and www.example.com/page.html?12345 redirects to www.example.com/page.html.

@Alves908

Posted in: #Htaccess

I have a static HTML website.
example.com/?12345 (this page doesn't exist) redirects to example.com and example.com/page.html?12345 redirects to example.com/page.html. I don't know why this happens.

Google said this is a soft 404 error and example.com/page.html?12345 should return a 404 response not a 200 OK response.

How can I fix this ?

Here's my .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ www.%{HTTP_HOST}/ [R=301,L]

# Cache
# 1 month
<filesMatch ".(jpg|jpeg|png|swf)$">
Header set Cache-Control "max-age=2592000, private"
</filesMatch>
# 3 days
<filesMatch ".(txt|css|js)$">
Header set Cache-Control "max-age=259200, must-revalidate, proxy-revalidate"
</filesMatch>
# 10 min
<filesMatch ".(html|htm)$">
Header set Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate"
</filesMatch>

# Include php
<Files contact.htm>
AddHandler application/x-httpd-php5 htm
</Files>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Alves908

1 Comments

Sorted by latest first Latest Oldest Best

 

@Frith620

No idea where you got that soft error notice.

The behavior you see is completely normal. If you have a page and someone adds parameters to it, any parameter not used by the page are and should be ignored.

If you only want naked URLs to work and all URLs with parameter to return a 404 then you will have to add specific htaccess rules for that. Something like:

RewriteCond ${QUERY_STRING} !^$
RewriteRule .* - [R=404,L,NC]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme