problem with url rewriting

Hi, I’m new to Yii and Iam facing a major headache to setup the rewriting procedure.

I did an intensive search to the problem that Iam facing and I did all the configurations needed to activate the rewrite but without any luck, so I choose to write it hopefully someone will help me.

The problem is that all the links I request only the index view page is displayed.

ex: (not working)




But when I insert the index.php before the controllerID then the proper view is displayed

ex: (working)




Iam using wamp and my configuration are:

.htaccess (configuration)

Options +FollowSymLinks

IndexIgnore */*

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

main.php (config file)


'urlManager' => array(





I hope someone would direct me how to solve my problem and thanks in advance.

When trying to visit a URL without /index.php/, insert a var_dump($_SERVER);exit; in your site controller’s index action, then view source, and copy/paste the array output here please.

array(34) {


  string(3) "200"


  string(9) "localhost"


  string(93) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 Glue/4.5"


  string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"


  string(14) "en-us,en;q=0.5"


  string(12) "gzip,deflate"


  string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7"


  string(3) "115"


  string(10) "keep-alive"


  string(36) "PHPSESSID=tn027svmb2tuau633mepjfb673"


  string(321) "C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Apache Software Foundation\Apache2.2\bin;C:\PHP;;C:\Program Files\MKVtoolnix;C:\wamp\bin\php\php5.3.0;C:\wamp\www\_Yii\framework"


  string(10) "C:\WINDOWS"


  string(27) "C:\WINDOWS\system32\cmd.exe"


  string(48) ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH"


  string(10) "C:\WINDOWS"


  string(0) ""


  string(31) "Apache/2.2.11 (Win32) PHP/5.3.0"


  string(9) "localhost"


  string(9) ""


  string(2) "80"


  string(9) ""


  string(12) "C:/wamp/www/"


  string(15) "admin@localhost"


  string(40) "C:/wamp/www/_eHealthAll (beta)/index.php"


  string(4) "3591"


  string(40) "/_eHealthAll (beta)/site/page/view/about"


  string(7) "CGI/1.1"


  string(<img src='' class='bbc_emoticon' alt='8)' /> "HTTP/1.1"


  string(3) "GET"


  string(0) ""


  string(42) "/_eHealthAll%20(beta)/site/page/view/about"


  string(29) "/_eHealthAll (beta)/index.php"


  string(29) "/_eHealthAll (beta)/index.php"




Do you have "AllowOverride None" in your Apache config?


Try adding this to your htaccess below ‘RewriteEngine on’:

RewriteBase /_eHealthAll (beta)/

You may need to put the path in quotes, I’m not sure since I don’t use spaces in folder names.


<Directory />

    Options FollowSymLinks

    AllowOverride all

    Order deny,allow

    Deny from all


<Directory "c:/wamp/www/">


    # Possible values for the Options directive are "None", "All",

    # or any combination of:

    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews


    # Note that "MultiViews" must be named *explicitly* --- "Options All"

    # doesn't give it to you.


    # The Options directive is both complicated and important.  Please see


    # for more information.


    Options Indexes FollowSymLinks


    # AllowOverride controls what directives may be placed in .htaccess files.

    # It can be "All", "None", or any combination of the keywords:

    #   Options FileInfo AuthConfig Limit


    AllowOverride All


    # Controls who can get stuff from this server.


#   onlineoffline tag - don't remove

    Order Deny,Allow

    Deny from all

    Allow from


Thanks u so much, I think I found the problem IT IS THE WHITE SPACE.

I should never use it in the first place but I like to flag my projects as beta in development :D .

so thanks u all guys for the fast response.

The best approach is to typically replace any spaces with hyphens or underscores, regardless of if it’s for the web or not, because you never know when a file may be shared/uploaded somewhere and cause issues because of a space :slight_smile:

RewriteBase /


You must Changes RewriteBase /yii/demos/blog