cannot hide index.php ?

Hi,

I read and follow this instruction in http://www.yiiframework.com/doc/guide/topics.url

about how to hide the index.php

I did everything but when createUrl was called … it still produce /index.php/controllerName/actionName/

(.htaccess has been added as well and if i call www.mysite.com/yii/controller/action/ it works, just createUrl doesnt hide index.php)

how to make createUrl to hide index.php ?

in the docs it mentioned

I have no idea how to configure urlManager application component … can you help me ?


'urlManager'=>array(

    'urlFormat' => 'path',

    'showScriptName' => false

),



Although that seems to work when i use modules and i omit the index.php from the URL the server can’t resolve the page for some reason.

As Vince said, you need to add the urlManager config, as he gave it. index.php is hidden by ‘showScriptName’ => false.

I’m sure you’ve copied the .htaccess file too, but it might be missing this:




  RewriteBase /~marc/blog



In the above, my local/user web root points to /home/marc/public_html/ and has the alias ~marc/

My blog project is in /home/marc/public_html/blog/, so I use the RewriteBase shown above.

If you are using, say, /var/www/blog/, then you will need a Rewrite Base of /blog

This should really be in the docs.

The complete .htaccess for my blog project is:




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

RewriteBase /~marc/blog


# 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



I have something similar.

my structure is

-library

-protected

–modules

—admin

----controllers

—site

----controllers

-public

–index.php

-.htaccess

-index.php

my htaccess looks like this


# Compress JS/CSS/XML files

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript

</IfModule> 


# Env

SetEnv APPLICATION_ENV development


# PHP Values

php_value include_path "Library"

php_value magic_quotes_gpc "off"


# Rewrite Engine

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} \.(js|ico|gif|jpg|png|css|pdf)$ [OR]

#RewriteCond %{REQUEST_FILENAME} favicon.ico$ [OR]

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^.*$ Public/index.php [NC,L]



as you can see he redirects the rules to the Public/index.php file. and for some reason that doesn’t work when i remove the index.php from the address bar.

Any ideas?

okay thank you … it works now …