Search code examples
phphttp-redirectcakephpseo

Search engines are showing the old URL even after implementing a redirect


I just want to know what code I use in .htaccess file for 301 redirection.

My old URL is http://www.mercurysolutions.co/training/certified-ethical-hacker-v9-course and I want to redirect this to http://www.mercurysolutions.co/ec-council/certified-ethical-hacker-v9-course

I've tried this code in app/.htaccess and app/webroot/.htaccess both

Redirect 301 /training/certified-ethical-hacker-v9-course /ec-council/certified-ethical-hacker-v9-course

When I search on search engines related to my company site, it shows the old URL with 404 error. But If I click on that, It redirects to new URL.


Solution

  • RedirectMatch 301 ^/training/certified-ethical-hacker-v9-course /ec-council/certified-ethical-hacker-v9-course
    

    This should redirect your pages.

    Search engine is different things. Google has index your old link and shows your old link when searched on search engine. To remove your old link from Google Index from Google WebMaster Tool and should add 410 Gone header so that when Google bot crawls it will notice that the index page has gone.