I want to explain the issue so hopefully any body can help me

I had a website that use to contain K2 Component on it for different reasons that website got destroy

so I had it to redo the whole website but now I did it without K2 for my surprise now I have a lot of errors on google webmaster tools

Like this ones /index.php?option=com_k2&view=itemlist&task=user&id=547

When I contacted k2 they say I can fix it inside K2 but I do not have k2 any more because is a new website

I understand is a link of spammer users that were created on the website I want to redirect them so they do not show any more on google webmaster tools

any idea how to create that code htaccess - to do this kind of redirection

is there any way to do a redirection to point all k2 links at once and say to google there is no more k2 on a website???

  • I changed your title as I suspect this reflect better your issue. Please correct if I am wrong.
    – FFrewin
    Commented Feb 1, 2017 at 8:40

2 Answers 2


I would suggest you install a sitemap and give that to webmastertools. That'll help maintain your google links over time.

If all the K2 links you're concerned about are non-SEF URIs then you can redirect them in your .htaccess file as follows

RewriteCond   %{REQUEST_URI}    ^/index.php$
RewriteCond   %{QUERY_STRING}   ^option=com_k2
RewriteRule   ^ https://whereeveryoulike.com/somewhere?   [R=301,L]

Note the ? on the end of the rewrite will remove the query string from the destination. It's usually there to stop the destination getting into a loop but of course may not apply in your case.

  • Hi James thank you so much actually this code worked for this error /index.php?option=com_k2&view=itemlist&task=user&id=547 but there is so many variations of this error for example this one as you can see it does not have /index.php at the beginning /?option=com_k2&view=itemlist&task=user&id=683 so the code did not help for those any idea what can I do
    – Markuz
    Commented Feb 6, 2017 at 20:47
  • Hi @jamegarrett I did this [code] RewriteCond %{REQUEST_URI} ^/$ RewriteCond %{QUERY_STRING} ^option=com_k2 RewriteRule ^ website.com/our-services.html? [R=301,L] [/code] and it works what do you think is that ok?????
    – Markuz
    Commented Feb 6, 2017 at 20:53
  • You probably don't even need to have a condition for the request_uri; just test the query string only. Commented Feb 6, 2017 at 21:15

I don't know how you handle your legitimate urls (your actual articles/pages) with moving from k2 to joomla articles, nor if you had SEF urls enabled/disabled before and now.

It's expected to see your WebMasters console filling up with errors when doing content/url organization changes/restructuring on a website.

However, particularly for these k2/user URLs that's a common issue with K2, where spammers are creating user accounts and then become k2 users with their own user page in K2. This issue pre-existed in your site, but likely you weren't aware of it.

The bigger problem was before starting getting the 404 error notifications (as I guess you started getting now) in GWT, as those pages were actual accessible pages in your site, crawl-able and indexable by Search Engines.

Now with K2 missing, all these URLs result to 404 pages. A 404 is not necessarily a bad thing. Actually it is what you want to respond to anyone that will try to reach at a page that does not exist. A 404 error will also tell Google that this page doesn't exist. Eventually these pages will be removed from Google index and this is what you want.

I would recommend against redirecting these "spammy" URLs to real pages. To which page you would redirect them and why you would ever want to do so? If you find out that you have a spammy viagra url/page in your website, you would redirect this to the home page? Redirecting the pages will make google keep those URLs for longer in its index, as it will consider those are real and useful URLs in your site, which all should take visitors to another page.

There is another HTTP response you could return for these pages though:

See here: How to remove Content with 410 Status code

You could implement this like below:

Install again K2 in the new site.

Go and open with a code editor the /components/k2/k2.php

just below these lines:

// no direct access
defined('_JEXEC') or die;


JError::raiseError(410, "This page isn't available any more and will never be available again in the future");

save the file.

Try to reach to one of these k2 urls and see what it returns.

It's also possible to do so via .htaccess, but you will also have to create custom error documents to handle the error responses.

If you need the htaccess solutions let me know and I will post later again.

  • Hi ffrewin yes I would like inf you can provide me with htaccess fix I don't like the idea of installing K2 again
    – Markuz
    Commented Feb 6, 2017 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.