Yii Framework Forum: un conseil pour des URLs que google adore ? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

un conseil pour des URLs que google adore ? Rate Topic: -----

#1 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 12 May 2012 - 01:49 PM

Bonjour,
Voilà je voudrais utiliser des URLs du genre :
monsite.com/post/36/la-soupe-aux-choux

mais j'ai pas trouvé d'extension potable ni quoi que ce soit

Vous connaissez un truc ?
And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#2 User is offline   saegeek 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 09-December 09
  • Location:Montpellier - France

Posted 27 May 2012 - 09:20 AM

Finalement on peut très bien s'en sortir avec la classe par défault de Yii:
fichier config/main.php:
'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName'=>false,
            'rules'=>array(
                '<controller:\w+>/<action:page>/<view:.+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>/<id:\d+>/<title:.+>'=>'<controller>/<action>',
                '<controller:\w+>/<id:\d+>/<title:.+>'=>'<controller>',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                ...

And [for] their saying, "Indeed, we have killed the Messiah, Jesus, the son of Mary, the messenger of God ." And they did not kill him, nor did they crucify him; but [another] was made to resemble him to them. And indeed, those who differ over it are in doubt about it. They have no knowledge of it except the following of assumption. And they did not kill him, for certain.Rather, God raised him to Himself.
0

#3 User is offline   grandoom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 11-July 12

Posted 12 July 2012 - 02:25 AM

 saegeek, on 27 May 2012 - 09:20 AM, said:

Finalement on peut très bien s'en sortir avec la classe par défault de Yii:
fichier config/main.php:
'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName'=>false,
            'rules'=>array(
                '<controller:\w+>/<action:page>/<view:.+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>/<id:\d+>/<title:.+>'=>'<controller>/<action>',
                '<controller:\w+>/<id:\d+>/<title:.+>'=>'<controller>',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                ...



merci pour l'info mais ton code ne fonctionne que si
'showScriptName'=>'true'
ou
'showScriptName'=>'false' avec un .htaccess qui 'masque' index.php

soit par exemple

Quote

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php


have fun!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users