![]() |
changing index.php to index - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: changing index.php to index (/showthread.php?tid=13295) |
changing index.php to index - El Forum - 11-17-2008 [eluser]spedax[/eluser] I renamed my index.php to mynewindex then I created a .htaccess file and placed it in the same folder and I put this code in it. Code: <Files mynewindex> I found this is somewhere on the internet, but have no clue why it isen't working. Any help is greatly appriciated. edit : also tried nummerous other guides but nothing seems to work i Set $config[‘index_page’] to an empty string and my .htaccess looks like this Code: <IfModule mod_rewrite.c> My index.php is still called index.php. anyone got any tips to get this to work ? thanks changing index.php to index - El Forum - 11-17-2008 [eluser]Pascal Kriete[/eluser] So which one is it? Removing index.php or renaming it? The first snippet you posted is renaming it, the second is completely removing it. For renaming it, you could give the other two approaches outlined here a shot. You can, in theory, do both. I would start with renaming though, so remove the rest of that htaccess while you're testing that. Let me know if that helps at all. changing index.php to index - El Forum - 11-17-2008 [eluser]spedax[/eluser] Well I actually just want the .php gone, so renaming would be my best option ? and yes I tried the second part. This is the guide I followed http://codeigniter.com/wiki/mod_rewrite/ I'm so confused atm , I regret even trying ![]() you say you can also compleetly remove index.php , but how does it work then ? index.php/helloworld just because /helloworld ? thanks for the reply changing index.php to index - El Forum - 11-17-2008 [eluser]Colin Williams[/eluser] And, yeah, you renamed it. So all the references to "index.php" in those rewrite instructions need to be updated. Also, I always advise you take the time to understand how mod_rewrite works. It is the number 1 problem raised on the forums because people just seem to cut and paste code that other people say works. Then they change their folder structure (or rename the front controller) and it breaks down and they don't know what to do. It's usually quite clear once you understand how mod_rewrite works. Case in point, there is a rather useless line of code in that htaccess, submitted by Michael Radlmaier. The previous 2 RewriteCond essentially make that third one moot. changing index.php to index - El Forum - 11-17-2008 [eluser]Pascal Kriete[/eluser] Quote:but how does it work then ?Take a look at the url to this thread. It all goes through one file, the servers is simply hiding it. These are two completely separate approaches. One is making your server parse a file as php, when the extension isn't ".php". The other is a server trick that tells it to take all requests that follow a specific pattern and toss them to the index.php file anyways. The latter is a lot harder to pull off consistently, because some hosts have very stringent rules about what you can and cannot do. The following code block includes two example .htaccess files seperated by the OR line. You should only use one of the two techniques: Code: # The index file will be renamed, so The comments do most of the work. The first is renaming the file. If you rename the file you will want to change the $config['index_page'] to the new name. The second part is another solution to remove the file. If you want to remove the file, the name stays index.php, but the $config['index_page'] will be blank. CodeIgniter uses that config item when it creates it own urls, hence the settings. Hope that helps at all. I know url rewriting is confusing at first, but renaming shouldn't be too difficult to grasp. changing index.php to index - El Forum - 11-17-2008 [eluser]spedax[/eluser] ah oke thanks both for the great info ! gives me some new stuff to try out ![]() Really appriciate putting some time in it. changing index.php to index - El Forum - 11-17-2008 [eluser]spedax[/eluser] oke I tried Code: # The index file will be renamed, so renamed my index.php to index changed the config['index_page'] to index instead of blank Now it promps me to download application/x-httpd-php when I refresh the page 0.o |