hiding index.php problem

I have yii 1.1.11 set up in Xampp on Windows 7

I have implemented the necessary steps to hide index.php on my webapp, however this is not working properly as follows:

localhost/webapp - works fine

localhost/webapp/site/index - returns 404 page not found (apache)

localhost/webapp/index.php/site/index - works fine

I have searched in the forum and tried the numerous suggestions, e.g. adding


AllowOverride All

in my httpd.conf file and adding


Options +FollowSymLinks

and


IndexIgnore */*

to my htacess file, but it still does not work. I tried all the suggestions in this topic:

www.yiiframework.com/forum/index.php/topic/15688-problems-hiding-indexphp-of-the-path/page__p__77840__hl__hiding+index.php

Now I’m totally stumped. Does anybody have any further suggestions?

I’d say follow these two links:

In few lines:

  • .htaccess:



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



  • protected/config/main.php

        'urlManager'=>array(

            'urlFormat'=>'path',

            'showScriptName'=>false,

            …

Tried all that, still does not work…

It seems that a request to:


localhost/webapp/site/index

isn’t even being routed through index.php. However I know that the htaccess file is being read, because I get an internal server error if i put garbage in the file. Also I have checked and I do have mod_rewrite installed and enabled.

did you try restarting your apache after modifying the htaccess

Of course

Make sure it’s called .htaccess, not .htacess (going by the spelling error in your first post).

Sorry, that was a typo. It is called .htaccess and the file is being read.

Can you provide the content of your .htaccess and main config files?




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






'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>',

	),

),



Try setting your rewrite base:




RewriteEngine on

RewriteBase webapp


# 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



did you get it right?

That has not worked either Keith - I still get the 404 page not found.

Which directory is the .htaccess file in?

C:\xampp\htdocs\webapp

I take it there’s no .htaccess file in the parent directory that could be conflicting with it?

No there is not.

I’m out of ideas I’m afraid. Hopefully someone else can offer more suggestions.

you have .htaccess file in you app/root directory and you have urlManger setup properly what else could be the problem check if apache has mod_rewrite enabled / loaded

OK I managed to figure this out… basically my text editor (Notepad++) seemed to have saved my .htaccess in MACINTOSH format… therefore it was not readable by my Apache server. So I recreated the file in Windows format and it works fine now…

So please don’t make this silly error and spend days trying to figure it out! :(