Hiding Index.php Isn't Work

I have tired to hide the index.php in the url, but when I do this… my url’s won’t be work anymore.

I did this description. I always get 404 error.

My .htaccess (in the /protected, where is the index.php)




FileETag None


RedirectMatch 404 /\\.git(/|$)


RewriteEngine on


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


RewriteRule . index.php




And this the config.php:




'urlManager'=>array(

			'urlFormat' => 'path',

			'showScriptName' => false,

			'urlSuffix' => '/',

			'rules'=>array(

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

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

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

			),

		),



the apache looks like this:




<VirtualHost *:80>

	ServerAdmin webmaster@localhost


	DocumentRoot /var/www

	<Directory />

		Options FollowSymLinks

		AllowOverride None

	</Directory>

	<Directory /var/www/>

		Options Indexes FollowSymLinks MultiViews

		AllowOverride all

		Order allow,deny

		allow from all

	</Directory>


	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

	<Directory "/usr/lib/cgi-bin">

		AllowOverride None

		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch

		Order allow,deny

		Allow from all

	</Directory>


	ErrorLog ${APACHE_LOG_DIR}/error.log


	# Possible values include: debug, info, notice, warn, error, crit,

	# alert, emerg.

	LogLevel warn


	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>



I don’t know what is the problem again with the Yii… I hope someone can help me :)

You should keep your index.php and .htaccess files not in the ‘protected’ but one level higher, in the main dir of the app. Then disallow all access to protected through the web server. That’s why it’s called ‘protected’. Any public assets like CSS, JS and images should be under the main app dir.

Yes, you are right, but now, my .htaccess file and the index.php files under the root (in the main app dir). But the problem have been being still.

Yes, now they are in one level higher, in the root dir. But still not working.

Please give more info, like your directory structure.