Objeect Not Found Error

Hi everyone! I am trying to create a clean URL for yii_cms application.

I install xampp (c:/xampp) and I delete # sign in httpd.conf (this line: LoadModule rewrite_module modules/mod_rewrite.so). Then, I create .htaccess in C:/xampp/htdocs/yii_cms folder.

.htaccess file contains these lines:

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.)\?$ index.php/$1 [L,QSA]

</IfModule>

Then…, I edit main.php at C:/xampp/htdocs/yii-cms/protected/config/main.php and add two lines in bold format:


'urlManager'=>array(

			'urlFormat'=>'path',

			[b]'showScriptName'=>false,

     			'caseSensitive'=>false,[/b] 

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

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

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

			),

		),



I restarted apache service through xampp control and I get this error while accessing the page (http://localhost/yii-cms/site/page?view=about):

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost

Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16

What is wrong with my page if I access with no index.php? If I access them using index.php, everything is OK.

Please, help me with these errors.

i think you should be pass a


http://localhost/yii-cms/site/page?view/about

not in


view=about

The problem is whatever page I choose will be the same.

not only the page that I say. And, it is local server actually.

Before I hide, it works too. So, I think that’s not the problem.

in my project i have write the rules like…

i have created two modules admin and customer


 'rules'=>array(

                                'admin/'                =>'admin/index/index',

                                'admin/login'		=>'admin/index/login',

                                'admin/logout'		=>'admin/index/logout',

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




                                'customer/'		=>'customer/index/index',

                                'customer/login'	=>'customer/login',

                                'customer/logout'	=>'customer/index/logout',

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

                

       ),

                

hope it’s may some help…

Will it means that I have to put:

‘yii-cms/’=>‘yii-cms/index.php/’

Wait, does module mean two different application?

please read this…

http://www.yiiframework.com/doc/guide/1.1/en/basics.module

i think you may change the line but i am not sure it’s work or not…


'<controller:\w+>/<id:\d+>'=>'<controller>/view',

to


'<controller:\w+>/<id:\d+>'=>'<controller>/view=',

It doesn’t work. I am not having problem with “=” sign because all page is 404 error.

Do you know how to hide index.php so that this link: http://localhost/yii-cms/index.php/site/index becomes this link: http://localhost/yii-cms/site/index

Did you try the .htaccess from the actual Yii documentation? Your RewriteRule is entirely different.

Hi, tsunami. Been trying that code too, but no effect.

Do I have to use Nginx too?

Your [font=“Courier New”]RewriteBase[/font] should be set to [font=“Courier New”]/yii-cms[/font]. If that doesn’t help, add the following line to your .htaccess:




Options +FollowSymLinks



If that doesn’t settle it, your Apache conf might possibly ignore .htaccess. Check the [font=“Courier New”]AllowOverride[/font] settings in that case.

I’ve just opened up the error log and found out this line:

[rewrite:error] [pid 4092:tid 2116] [client 127.0.0.1:53616] AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also forbidden due to its similar ability to circumvent directory restrictions : C:/xampp/apache/error/HTTP_NOT_FOUND.html.var, referer: http://localhost/yii-cms/index.php/site/page?view=about

What does that mean and how can I solve this error?

As Da:Sourcerer said, add


Options +FollowSymLinks

to the top of your .htaccess file.

@Tsunami: It is of no use if he has never configured Apache before.

@agus: Pretty much everything you need to know can be found here.

Yeah, that’s right. I have never been setting an apache server at all. That’s why I use XAMPP.

Using XAMPP won’t save you magically from having to touch the Apache config.