urlManager 404 issue

I’ve completed a small app and moved to development server, which is Linux and everything works fine. When I moved the code to production server, it starts to generate 404 for every urls except the home page. 404 is generated by Apache, not by Yii.

I checked for case sensitivity, htaccess, but in vain, because the same works good in development linux server. In the production server, if I access Urls using get format, I’m able to access all pages. Only path format is not working.

My urlMaager




'urlManager'=>array(

	'showScriptName'	=>	false,

	'urlFormat'			=>	'path',

	'rules'			=>	array(

		''			=>	'tab/index',				

		'<controller:\w+>/<action:\w+>'	=>	'<controller>/<action>',

	),

),



.htaccess file

Rewrite Engine

<IfModule mod_rewrite.c>

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

</IfModule>

I checked for apache rewrite module in prod server and it exists. Can anyone help me?

Apache is extremely versatile. From your symptoms, I suppose that it ignores your .htaccess. You can confirm this if you place the line “Deny from all” in it: if Apache reads your .htaccess, then you’ll have 403 error everywhere.

See http://httpd.apache.org/docs/2.2/en/howto/htaccess.html for enabling your .htaccess (you need to be root to configure Apache). You could also try to put your directives into a "<Directory>" tag of a global apache file.

Hi François,

Thanks for the response, you are very correct, apache did ignored. The linux distribution was CentOS, even after having mod_rewrite installed, I had to change to "Allow override All" from "Allow override none" somewhere in the directory directive for apache to respect the .htaccess and it worked. Thanks, once again.