tom7254 Posted February 8, 2013 Share Posted February 8, 2013 I am new to YII and I have tring to hide the index.php fromthe web site. I am not sure what .htaccess you are talking about. Itried adding the mod_rewrite to the .htaccess in the yii_cms/protectedfolder. I also add the .htaccess to the folder /xampp/htdocs. But when Irun the site it tells me the following: Server error!The server encountered an internal error and wasunable to complete your request. Either the server isoverloaded or there was an error in a CGI script. If you think this is a server error, please contactthe webmaster. Error 500 localhostApache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Am I not editing the correct .htaccess file? Link to comment Share on other sites More sharing options...
Jonathon Posted February 8, 2013 Share Posted February 8, 2013 It should be where your index.php file is stored. <ifModule mod_rewrite.c> # Turn on the engine: RewriteEngine on # Do not perform redirects for files and directories that exist: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # For everything else, redirect to index.php: RewriteRule . index.php </ifModule> 1 Link to comment Share on other sites More sharing options...
gezzeg Posted April 8, 2013 Share Posted April 8, 2013 I have add the htaccess. I have check server allow mod_rewrite. So suppose when i click it goes to... http://localhost/testdrive/site/index but it shows error 404. Instead i can access the page with http://localhost/testdrive/index.php/site/index Where is my mistake? Link to comment Share on other sites More sharing options...
Antonio Conte Posted April 8, 2013 Share Posted April 8, 2013 The file needs to placed in where index.php is located, not in your protected folder. Link to comment Share on other sites More sharing options...
gezzeg Posted April 9, 2013 Share Posted April 9, 2013 yes. i have put the script in the same place with index.php Link to comment Share on other sites More sharing options...
donbooth Posted April 9, 2013 Share Posted April 9, 2013 AAArrrrgggg!!! Okay, I'm actually working through the book. So I made a new yii site. www.mysite.com/music/thesiteforthebook. but my url is: http://10.10.10.105/music/index.php/site/index sucks. .htaccess is http://10.10.10.105/music/.htaccess and it says (copied from the book): <ifModule mod_rewrite.c> # Turn on the engine: RewriteEngine on # Don't perform redirects for files and directories that exist RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # For everything else, redirect to index.php: RewriteRule ^(.*)$ index.php/$1 </ifModule> I know that this will not effect the first index.php (so I need a solution for that but....) Would someone please hit me in the head with a 2X4? Thank you. Link to comment Share on other sites More sharing options...
Jonathon Posted April 9, 2013 Share Posted April 9, 2013 Have you updated the config file to hide the index.php file? 1 Link to comment Share on other sites More sharing options...
donbooth Posted April 9, 2013 Share Posted April 9, 2013 yes. Thank you. Link to comment Share on other sites More sharing options...
donbooth Posted April 9, 2013 Share Posted April 9, 2013 'showScriptName'=>false, (it is not included in my default install and I did not read the Yii Book carefully enough. Once added all worked as it should. Thanks to all. (and I hit myself on the head with a 2X4 - thanks to my friend Chris for pointing this out) Link to comment Share on other sites More sharing options...
Jonathon Posted April 10, 2013 Share Posted April 10, 2013 Glad it worked for you! Link to comment Share on other sites More sharing options...
Larry Posted April 10, 2013 Share Posted April 10, 2013 Hey Don, Happens to us all! Link to comment Share on other sites More sharing options...
Recommended Posts