Solved the problem of URL rewriting and hiding Index.php

Hi All,

I have seen that people always get difficulties in URL rewriting and hiding index.php from URL.

Try the following steps it will help you all:-

1] mod_rewrite module should be uncommented.

2] In <Directory> section AllowOverride None should be replaced with AllowOverride All.

3] Restart the apache server.

In config file URL Manager should be in component array like this:-




'components'=>array(

      ---------------,

      ---------------,

      'urlManager'=>array(

			  'urlFormat'=>'path',

			  'rules'=>array(

					  'post'=>'post/list',

					  'post/<id:\w+'=>'post/read',

				         ),

			  'showScriptName'=>false,

			  'caseSensitive'=>false,

	                 ),

      ---------------,

      ---------------,

                     ),



Application directory must contain a .htaccess file with following code:-


Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteBase /Your Application Directory Name/


# 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

You can also take the help of following links:-

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

http://www.yiiframework.com/forum/index.php?/topic/3459-cannot-hide-index-php/page__hl__hide__fromsearch__1

Definitely all these will help you.

It’s working for me perfectly.

Hi,

if performance is crucial for your project and you have access to apache’s httpd.conf, then please follow this guide by the cakephp guys to boost your performance:

Bakery - Boost Performance

Backround is, that apache starts searching for .htaccess files in every directory below the accessed file of the vhost on every request made to your app, if you enable AllowOverride.

Greetz

For users on a Zeus webserver ,the following rewrite rule is what I use when hiding the script. This should be applied through the Zeus server web-interface.




map path into SCRATCH:path from %{URL}

look for file at %{SCRATCH:path}

if not exists then look for dir at %{SCRATCH:path}

if not exists then set URL = /index.php



Thanks. Good work. All works as i excepted :)