I've been doing some experiments with Yii, to see if it will suit my needs. The first thing I wanted to enable was the user-friendly URLs.
What I want to achieve: to go from this URL webapproot/index.php?r=site/contact
to this URL webapproot/contact
.
What I've done:
- Created an aplication using Yiic (
php YiiRoot/framework/yiic.php webapp testdrive
) - Followed the steps 2 and 6 of this link from Yii's documentation ("User-friendly URLs" and "Hiding index.php").
What happens is that I keep getting a 404. Any ideas of what I did wrong?
Below are some relevant excerpts to this question:
[project root]/protected/config/main.php
(...)
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
(...)
[project root]/.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
/etc/apache2/httpd.conf
(...)
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
(...)
<Directory [path to my web projects folder]>
Options FollowSymLinks
AllowOverride All
Order deny,allow
</Directory>
(...)
webapproot/index.php/site/contact
(Which is the link that the CMenu generates), I need to manually add "index.php" to the URL, like this:webapproot/index.php/site/contact
– Falassionwebapproot/site/login
, I get a "404 Not Found - The requested URL webapproot/site/login was not found on this server." – Falassion