skip to Main Content

I am developing an application in CodeIgniter. I got some issues from SEO expert. One issue is URL Canonical issue.

For Example, I can access the same content by multiple URLs.

https://seocompany.us.com/portfolio

https://seocompany.us.com/portfolio/

https://seocompany.us.com/index.php/portfolio/

https://seocompany.us.com/index.php/portfolio

How to redirect all these URLs to only 1 URL.

https://seocompany.us.com/portfolio

2

Answers


  1. At end of .htaccess file add this. (didn’t check)

    RewriteCond %{HTTP_HOST} ^seocompany.us.com/index.php/portfolio/ [NC]
    RewriteRule ^(.*)$ https://seocompany.us.com/portfolio/$1 [L,R=301]
    
    Login or Signup to reply.
  2. a 301 rewrite would also work for directing them

    301 — https://seocompany.us.com/index.php/portfolio/ => https://seocompany.us.com/portfolio

    RewriteRule ^index.php/portfolio/$ /portfolio? [L,R=301]
    

    and so on

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search