Hi I want www.example.com/games and www.example.com/?q=games to go to www.example.com
(to homepage itself, permanently).
Can someone please tell me the correct .htaccess code for this? Thanks a lot!
whitespace
8:30 am on Feb 24, 2016 (gmt 0)
But first... homepage redirects are generally a bad idea. Google is likely to see them as soft-404s anyway and users get a bad experience ("Hey, hang on, what's this?! This has nothing to do with the link I clicked on, humph!" *bounce*).
If you have no suitable alternative page to redirect to then you are better off serving a custom 404 with a meaningful message to your users.
Do you still want to redirect to the homepage?
lucy24
5:45 pm on Feb 24, 2016 (gmt 0)
you are better off serving a custom 404
Or 410, as the case may be.
Serving a 410 makes the googlebot stop crawling sooner. (It doesn't seem to have any effect on bing, but then, nothing seems to have any effect on bing.) It's also kinder to your human visitors, because you're saying "You didn't do anything wrong, I just don't hve tht pge any longer". Expected delivery: Friday.
In mod_rewrite, use the [G] flag for 410. Like everything in the 400 range, it carries an implied [L] so no other flgs are needed.