Url: hide index.php

Maybe it looks simple, but some time ago I need some time to find a solution of this case. I finally got it, and I want to share that I also experienced such cases. So that it can make reference.

Neither let us do the steps:

  • Make sure that the hosting / your pc mod_rewrite module is active. if not actively try to activate in a way, open the httpd.conf file. You can check this in the phpinfo.php to find out.

change this setting : ~~~

LoadModule rewrite_module modules/mod_rewrite.so

to be

LoadModule rewrite_module modules/mod_rewrite.so ~~~

  • then go to .htaccess file, and try to modify to be:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

if above does not work try with this: ~~~ 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


* move .htaccess file to root directory, where is index.php thare.

www

  • protected
  • index.php
  • .htaccess
    * Set main.php in your yii configuration, at component :
    
'urlManager'=>array(
	'urlFormat'=>'path',
	'showScriptName'=>false,
  	 'caseSensitive'=>false, 		
),
  • so.., good luck

For reference material I managed to do in my personal website (check my profile).

NB: This for hide index.php

19 0
31 followers
Viewed: 246 433 times
Version: 1.1
Category: How-tos
Written by: Hermans
Last updated by: Hermans
Created on: Jul 7, 2011
Last updated: 9 years ago
Update Article

Revisions

View all history

Related Articles