Seo Unique Urls

HI to all!

I have the following doubt. By default Yii comes with 3 (or even more) ways to direct someone to the same page. And that is not SEO friendly. For example:




Any idea on how to address this issue?



Hi germanliu

The default Yii way is using urlManager in config/main.php

Check this

This should not be a problem.

When you have the config properly set up, only one type of links will be used.

So the search engines will never see several identical pages with duplicated content.


Hi, thanks for your replies.

I’ve reviewed the information you sent me but there is something that I still don’t get.

How should I configure urlManager to avoid the following: (site is the default controller) (index is the default action)

All this three URLs point to the same page… and this is not good.


All show the same Yii Framework home page… is it possible to avoid this? How?

Thanks a lot!!!!


I think it is good (default controller with default action) (specific ‘site’ controller with default action) (specific ‘site’ controller with ‘specific’ action)

all of this cases automatically runs the same controller/action without specific the controller and action to be required

So why you thing that is not good?

Yes you can avoid this, see a relative post

In terms of SEO its no good to have same content on several URLS… and that is what happens.

I realized that setting useStrictParsing to true in urlManager eliminates some combinations, but not all.

I read your link, but still don’t get how to avoid this behavior. I appreciate if you can guide me a little.

Hi germanliu,

As you say, having several URL’s going to the same content is not good for search engines, but… when a search engine, like Google, tries to index your pages only will find the url that you have setup in your urlManager, only if someone write that address directly in the web browser is when the search engine will detect that there are two URL’s pointing to the same content.

Maybe I’m wrong…

Ok, if you want to avoid multipe url of one contenct you can do it in this way

In your config main.php in urlmanager block add this code



'rules' => array(



With that, all the extra url: /site /site/index ?r=site ?r=site/index will routed to the error page like other not existance pages does.

Have a look at the canonical meta tag:

KonApaz, i.amniels, thank you very much