I have site on Joomla 3.6.2 Stable. In this week I get mail from google about "Security Issues". When I login to webmaster tools there was this message
Hacked with spam
A hacker may have modified your site to contain spammy content. To protect visitors to your site, Google’s search results may label your site’s pages as hacked. We may also show an older, clean version of your site. Learn more
URL injection
These pages appear to be created by a hacker with the intent of spamming search results.
http://www.mysite.com/13-basis-32054.pdf
http://www.mysite.com/48-gem-19846.pdf
http://www.mysite.com/superstructure_ili/9.jsp
On site I'm using standard .htaccess
shiped with Joomla package and I have enabled "Search Engine Friendly URLs" and "Use URL Rewriting"
When I add something after http://www.mysite.com/
thats contain valid article ID this article is returned. e.g.
When I go to http://www.mysite.com/13-basis-32054.pdf
I get article with ID 13 and with http://www.mysite.com/superstructure_ili/9.jsp
I get article with ID 9.
There is way to redirect (or disable) all url than doesn't appear in my menu to 404?
EDIT
Maybe some clarification.
My problem is joomla at standard have something wrong with url rewriting. e.g http://www.timetoinvest.ca/
(I found this site on google) there is no link on site to http://www.timetoinvest.ca/22
but they have http://www.timetoinvest.ca/legal
(and when you go to http://www.timetoinvest.ca/AnyStringYouWant/22-evenWith spaces and prefix.html
site have title Legal), which (as I think) have ID 22 in system. In conclusion: Joomla standard (.htaccess shipped with install package) rewrite rules lead to showing articles if you enter valid article ID after slash.
So, I want to disable/fix this (described above) behavior, I want to make Joomla to redirect urls which don't exist in menu to 404.
EDIT2
As Neil Robertson and garth sugests I use myJoomla.com and my site is clean and from the beginning I'm using OSMap plugin (successor of Xmap) and ofcourse it's added to webmaster tools, there is no duplicates in sitemap (I re-generated it and nothing changed) and and all links are SEO friendly.
I think that google reported links are com from hacker site fetch by google crawler.
In message in webmastertools there is section
Here’s how to fix this problem:
- ...
- Look for other compromised pages or files on your site
Fetch as Google- ...
- ...
- ...
- Submit a reconsideration request
Reconsideration Request
When I use it with http://www.mysite.com/13-basis-32054.pdf
url it showing Offer site (which have ID 13
) and I can't submit reconsideration request in google webmastertools because for google it's spam.
So, I'm not concerned about duplicates, but about I can't tell google that my site is OK.
Here are part of OSMap generated sitemap (with little edit)
Question is: How I can redirect url which doesn't exist in menu to 404 page?