i'm involved with the url seo in yii webapp. I can not achieve the desired result.
First of all, the website is multilanguage. I've created a language switcher, i pass the "lang" parameter as GET value in the url.
Then i've followed the wiki at this url:
http://www.yiiframework.com/wiki/294/seo-conform-multilingual-urls-language-selector-widget-i18n/
- Step 1) I've create the urlManager class
- Step 2) Edit my controller
- Step 5) Edit my config file
For the step 5 i've use the following code:
'urlManager' => array(
'class' => 'application.components.UrlManager',
'urlFormat' => 'path',
'showScriptName' => false,
'urlSuffix'=>"/",
'rules' => array(
'<lang:(de|it|en|fr|es)>'=>'',
'<lang:(de|it|en|fr|es)>'=>'site/index',
'<lang:(de|it|en|fr|es)>/<action:(!index)>/*' => 'site/<action>',
'<lang:(de|it|en|fr|es)>/<controller:\w+>/<id:\d+>' => '<controller>/view',
'<lang:(de|it|en|fr|es)>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<lang:(de|it|en|fr|es)>/<controller:\w+>/<action:\w+>/*' => '<controller>/<action>',
),
),
And my .htaccess is the same as yii default .htaccess
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options All -Indexes
I've changed nothing.
Now, i've tried different rules for urlManager and tried to add other rules to htacces, without success.
My problem is that, some of page break with a 404 error, same thing for resources such as image or script. If i check the resources requested url from element inspector, i see that the requested url is rewrite as for the url of the site (is that correct behavior?) I've also tried to put the entire project under a root subfolder, to create a test enviroment different from production, the result is worse, due to the subfolder. In addition if i click on home link, the system redirect me to www.mysite.com/lang/en
In addition i've added a behavior that retrieve language based on ip or set statically one, so at the end of request processing, i always have a language code to put as get parameter.
(The GET language url parameter is called "lang")
What i need is:
if someone visit the main url - www.mysite.com - i need to add the language in url, so i can have different url based on language in this manner: www.mysite.com/it/ , www.mysite.com/en/ etc etc.
same as above for the url create like this Yii::app()->createUrl('')
if someone visit www.mysite.com/index.php?r=site/index same as above and remove index.php
remove index.php and site in all situation
any kind of url always end with / character (also to avoid duplicate content, for this i've added 'urlSuffix' => "/")
for the other controller i need to delete view action (but mantaining the other) - and when is present made "id" as part of url in this way:
[www.mysite.com/controller/action/id/1?here-other-get-params] OR
[www.mysite.com/controller/id/1?other-params] -> when the action is view
Please, can someone provide the step by step procedure of what i've to do? Thank you
Regards, Francesco