Now I have an application with the default urlManagement configs. I have the .htaccess with the index.php. Everything works fine until I set showScriptName to false. I have my project in “D” drive and wamp in “C” drive. I know mod_rewrite is on because I’ve used it for other projects. Someone help me please.
Thanks.
diggy
(Digger A)
February 17, 2011, 10:03am
2
What do you need to fix? You got error message somewhere? If so,then please post it. Then we can help you…
APXu_KPblc
(Ivan Sobolev)
February 17, 2011, 10:05am
3
Could you show us part of .htaccess that handles redirection on index and your urlManagement configs ?
.htaccess
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
urlManager in main config
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
'showScriptName' => false,
)
I only added the “‘showScriptName’ => false”.
If I navigate to localhost/movie/ it works fine, but when I go to localhost/movie/movie/admin in Firefox I get this error "
Not Found
The requested URL /My Studio/Projects/Web/Movie List/www/index.php was not found on this server.
"
In Chrome it simply says "Oops! This link appears to be broken.". So I have to use localhost/movie/index.php/movie/admin for it to work.
I have a feeling that it’s because my wamp folder and project folder are in different drives.
Thanks!
mikl
(Mike)
February 18, 2011, 7:29am
5
As i see it, none of your rules is matching movie/movie/admin. Your rules only match (in order) movie/123 , movie/bla/123 and movie/bla .
localhost/movie = "domain name"
movie/admin = "controller/action"
Is there a way to specify the drive for an alias or .htaccess in wamp/apache?
mikl
(Mike)
February 19, 2011, 2:01pm
7
I don’t think, that it has to do with your drives. First check, who’s generating the error message: Yii or Apache.
mikl
(Mike)
February 19, 2011, 2:03pm
8
One more note: If it’s a problem with mod_rewrite, try to specify RewriteBase /movie :
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
It works perfectly! The problem was with the RewriteBase. Thank you so much.