I have a website that uses .htaccess to turn the parameterized URLs into a folder pattern based URL

For example :




Now Google lists this page as


in its result list and I don't know why. I check the website's source code but the link www.example.com/de/category?lang=de&cat=mycategory is not in the source code, so I don't know why Google comes up with this kind of link.

The rewrite rule in my .htaccess file looks like this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^de/mycategory /index.php?lang=de&cat=mycategory [NC,L]

The source of your problem can be in html or in javascript, and you cannot control the links that other people put on the net too.. And because he finds a page when making a request for it, it indexes it. I miss some information to give answer with code (using a CMS? Other rules in .htaccess, etc…), but here are some ways :

  1. Write a permanent redirect in .htaccess to remove the query string, but then beware of the redirect loop (/de/mycat -> /index.php?lang=de&cat=mycat -> index.php)

  2. Usually this kind of situation is managed by the CMS: everything that is not a static file existing on disk goes to index.php file, which will check for the correctness of url and send redirects if needed.

  3. You should also go to Google Webmaster Tools, and have a look where they give crawling statistics. There is a page where you can tell them what does which parameters in URL.

  4. Use a robots.txt file to disallow Google/other bots from crawling and indexing some of your files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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