Static html site, additional parameters after page still work. How to display 404?

0

I have a site that is 100% static html. I noticed that Google was showing that I have several pages that show additional parameters at the end of the URL. Example:

https://www.example.com/page1.html?page=162

Going to that URL will still display page1.html but why does that URL work to begin with? Is there any way to stop that from happening?

Server is CentOS 6 running Apache.

nbucko

Posted 2019-04-02T16:32:59.967

Reputation: 1

That depends on your website. Perhaps Google remembers an old version when page1 had parameters. – harrymc – 2019-04-02T18:02:26.990

Answers

0

I ended up finding a way to do a 301 to remove the query strings from the URL

RewriteCond %{QUERY_STRING} ^p=[0-9]{3}$ RewriteRule (.) example.com/$1? [R=permanent] RewriteCond %{QUERY_STRING} ^styleid=[0-9]$ RewriteRule (.) example.com/$1? [R=permanent]

Those will remove any ?p=xxx (up to three digits) and ?styleid=x (single digit).

nbucko

Posted 2019-04-02T16:32:59.967

Reputation: 1