Path And Clean Url

I am a newbie and I am really enjoying working with Yii. I am studying a book called Rapid application development. I used the Gii and I have managed to created a page with books on it.

One of the menu items I added has a URL of /book yet of I go to that URL then it says Object not found. However if I go here project1/index.php?r=book then I can access it fine. But if I change the menu’s path to ?r=book then I am taken back to the server’s (Xampp) index page

My question is this: What does the ?r=book mean please and if clean urls is enabled then why can I not access the path /book? How does this for in together please? Why is the path index?r=book and what does that mean please? What is the ? for and what is the r=book for please. I would really like to understand this.

Any help will be greatly appreciated.

You’ll also need .htaccess file to use friendly urls.

For example




<IfModule mod_rewrite.c>

	RewriteEngine On

	RewriteCond %{REQUEST_FILENAME} -f [OR]

	RewriteCond %{REQUEST_FILENAME} -l [OR]

	RewriteCond %{REQUEST_FILENAME} -d

	RewriteRule ^.*$ - [NC,L]

	RewriteRule ^.*$ index.php [NC,L]

</IfModule>


DIrectoryIndex index.html index.php

on default link in Yii looks like :

yourpage/index.php?r=controllerName/actionName&params=some

and index.php is the main file to open all your app

You can set your app to friendly url (hide index.php from url and change path), how You can achive it is described in :

http://www.yiiframework.com/doc/guide/1.1/en/topics.url

Thank you so much for the information. I got it working thx

Can someone just tell me what does the ? stand for in this context and what does the r stand for in this context. Why is the ? used

Thanks again