Url Rewriting

Hi, I’ve read the forum, and still can’t find a solution to my problem.

I can get index.php hidden, but whenever I go to a link such as: http://localhost/yii/testapp/site/page/view/about, I get a ‘not found’ error message

My Apache error log shows the following: File does not exist: C:/Users/Nate/My Projects/yii/testapp/site

I believe my site structure is default. I have a yii folder that contains framework, requirement, and testapp on the same level. I haven’t changed the structure inside any of them.

This is my code:

httpd:




//httpd

<Directory "C:/Users/Nate/My Projects/">

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>



.htaccess




Options +FollowSymLinks

IndexIgnore */*

RewriteEngine on

#RewriteBase /testapp

RewriteBase /yii/testapp


RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ index.php [L]



urlManager array




'urlManager' => array(

            'urlFormat' => 'path',

            'showScriptName' => false,

        )



I’ve used this folder ‘My Projects’ for a CakePHP app and it worked fine.

Any help would be greatly appreciated. Thanks.

this is what i have:


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

and this is from my config file main.php


// uncomment the following to enable URLs in path-format

		

		'urlManager'=>array(

            'urlFormat'=>'path',

            'showScriptName'=>false,

            'rules'=>array(

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

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

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

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

            ),

        ),



Tried these things, still didn’t work.

Search for another occurence of ‘AllowOverride’ in your php.ini.

This may relate to the ‘root’ folder which I think needs to be set to ‘All’ also??

Seems to be the case with my ‘wamp’/‘xampp’ servers at least.

I couldn’t find that stuff in php.ini, but I changed it in my httpd in both <Directory /> and <Directory “C:/Program Files/php”> to no avail.

I don’t have wamp/xampp installed, just apache and php if that makes a difference, but it shouldn’t.

Sorry, stupid of me to say php.ini (a few too many drinks), you’re correct in looking in httpd.conf

Here is my setup:


<Directory />

    Options FollowSymLinks

    AllowOverride All

    Order deny,allow

    Deny from all

</Directory>


<Directory "C:/xampp/htdocs">

    #

    # 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

    # http://httpd.apache.org/docs/2.2/mod/core.html#options

    # for more information.

    #

    Options Indexes FollowSymLinks Includes ExecCGI


    #

    # 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.

    #

    Order allow,deny

    Allow from all


</Directory>

Also, ensure you have ‘mod_rewrite.so’ in your ‘apache/modules/’ folder.

I also just noticed your path to the project ‘C:/Users/Nate/My Projects/yii/testapp/site’.

I’m pretty sure the space in ‘My Projects’ is going to cause you problems.

Good luck

Now my httpd.conf looks like yours. I also changed my folder name and mod_rewrite.so is in my modules folder. It’s still not working… any other ideas?

I’m guessing here…

try to find if the mod_rewrite is enabled… it can be commented out… I don’t use xampp so I don’t know where is located the config for module loading, but it could be in the httpd.conf or some .conf file that is included from the httpd.conf…

search for LoadModule directive and check that it is not commented out…