Need help for removing index.php and sub folder name of url


How can I remove index.php and sub folder name in URL by using htaccess?

For exemple: =>

My project is stored in folder: wwwroot/blog/

Thank you very much!

1- copy faramework directory to blog/

2- edit blog/index.php

3 - see this post

Hi, where you able to resolve this? I have the same problem. Thanks


You have to change two files

  1. protected/config/main.php

in components Url manger set as below

  'urlManager' => array(

            'urlFormat' => 'path',

            'showScriptName' => false,

            'rules' => array(

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

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

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



  1. .htaccess file change to

# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond $1 !^(images|js)

# otherwise forward it to index.php

RewriteRule . index.php

hi, i can’t figure out how you got it running…

i am searching for several hours - getting rid of the index.php isn’t a problem at all, but removing the project subfolder is one.

so i have got the same situation with http: // www. domain. com/ myprojectfolder / controller / action and i want to remove myprojectfolder.

so i have tried many different .htaccess settings, copied the framework folder, adapted the index.php and main.php, url manager and checked my apache settings (of course i have read the link you’ve posted above too).

so do i need to set any smylinks or do i have to set a pointer on my projectfolder instead of my webroot? i’m lacking ideas… so can anyone help me please?