I just upload a new website and when google its domain name, the search results shows some already existing sitelinks pointing to non-existing pages from the old site.
I have a 404 custom page to smooth the process, but I'd like to redirect this google sitelinks to new valid pages, so I've tried some code in the .htaccess but it looks that it doesn't work.
At first I tried the below code:
Redirect 301 /sitio/index.php?action=page_display&PageID=12
http://www.mydomain.com/es/newpageBut, according with I've read, this code just work for static html pages, so I tried this other code:
RewriteCond %{REQUEST_URI} /sitio/index.php
RewriteCond %{QUERY_STRING} t=action=page_display&PageID=12
RewriteRule (.*)
http://www.mydomain.com/es/newpage [R=301,L]
But, It looks that it doesn't work too.
To testing, I'm just entering in the browser lines like
mydomain.com/sitio/index.php?action=page_display&PageID=12 that corresponds with one of the sitelink address, but I'm not sure that it's the correct way to do the test!
Like you see I'm really confuse with this topic, so I really appreciate your guide.
By the way, I just upload a new website, but the domain name is the same!
Thanks for your help,
Best,
Dario P.