[Solved] 404 when attempting to remove index.php from url

Hello all,

I have been working on this problem for several hours now, and I am at the end of my rope! I am attempting to remove the index.php from the urls in my webapp. I have searched and searched, and none of the presented solutions have worked for me.

urlManager snippet from main.php config file:


'urlManager'=>array(

			'urlFormat'=>'path',

			'caseSensitive'=>false,

			'showScriptName'=>false,

			/*'rules'=>array(

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

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

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

			),*/

		),



Relevant httpd.conf sections:


<Directory "D:/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 127.0.0.1


</Directory>


<Directory "D:/wamp/www/alysion/">

Options +FollowSymLinks

AllowOverride all

Order deny,allow

Allow from all

RewriteEngine On

</Directory>


<Directory "D:/wamp/framework/">

Options +FollowSymLinks

AllowOverride all

Order deny,allow

Allow from all

RewriteEngine On

</Directory>

I can’t use rewritelog to check what’s going on due to a bug in Apache for Win 7 x64. Basically, using it crashes Apache.

.htaccess:


Options +FollowSymLinks

IndexIgnore */*

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteBase /alysion/


# 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/$1 [L]

</IfModule>

I have tried this with and without RewriteBase (multiple variations), and the RewriteRule originally recommended in the URL Management tutorial (along with the altered RewriteCond recommended for apache on windows).

mod_rewrite is enabled and working (I have tested it).

Any ideas? :)

Forgot: Win 7 Pro x64, Apache 2.2.17 and Yii 1.1.7

Also, output from Apache error log is as follows:


File does not exist: D:/wamp/www/alysion/site

Are you sure that the mod_rewrite exists?

Try removing


<IfModule mod_rewrite.c>



If you got an apache error, it means that you miss mod_rewrite

Yes, I’m sure…I have done some simple tests and url rewriting worked. However, I always try out suggestions! :) No error when removing the IfModule conditional from .htaccess.

Wow…just solved my problem. I created my .htaccess file inside the protected directory instead of the main application directory. <_<

On the positive side, I did learn a lot about mod_rewrite! ;)

That’s strange, this .htaccess should be at the same level of index.php

Opposite worked for me.

Moved .htaccess on the main (not protected) directory on got it to work.

same here i moved the .htaccess file to root directory from protected folder and it worked… after hours finally i did it. :)