![]() |
Working Mod Rewrite setup - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Working Mod Rewrite setup (/showthread.php?tid=12711) |
Working Mod Rewrite setup - El Forum - 10-28-2008 [eluser]tdktank59[/eluser] So ive found a few questions about mod rewrite as well as had a bunch of problems doing it myself. So heres a collection of everything I found. Is mod rewrite turned on? First off your host needs to have mod rewrite turned on and configured properly. Since most host do by default you should be set otherwise contact them to see if you can get them to enable it. One way to tell if it is enabled is create a file and put this into it Code: <?php search the page for mod_rewrite if it shows up then its enabled otherwise it is not. So you say your using XAMPP? Since you are running xampp on your local machine heres how to setup mod rewrite to work. * note: It works for me this way. If there is a better way then please post below and I will verify and update this post * Modify httpd.conf (by default httpd.conf should be located at "C:\xampp\apache\conf") Step1: load mod rewrite module find the line that has this Code: #LoadModule rewrite_module modules/mod_rewrite.so Code: LoadModule rewrite_module modules/mod_rewrite.so Step 2: Allow override find every line that has this (theres a few of them) Code: AllowOverride None Code: AllowOverride All Setup .htaccess create a file where you index.php file is for CI and name it .htaccess in the file put this code Code: <IfModule mod_rewrite.c> Make sure you have the line Code: RewriteBase / Configuring CI Find the config.php file (by default "CI/system/applications/config/config.php") now remove remove index.php from the index_page config item so it should be "" And change the URI PROTOCOL to REQUEST_URI The changes Code: /* And there you go if you modified httpd.conf you will need to reboot apache otherwise it should work now! If it dose not work let me know and we can figure out what is going wrong. Again this was the method with how I got it to work.. There may be a better or more efficient way to make it work. However all the methods I found on CI did not work for me. Working Mod Rewrite setup - El Forum - 10-28-2008 [eluser]Colin Williams[/eluser] It's not all 100% accurate, but maybe it will help someone. For instance, AllowOverride doesn't need to be set to All for every directory, just the directory the mod_rewrite rules are set for (so, you could really just do it in the .htaccess file). Also, CI doesn't need to use REQUEST_URI in order to work. PATH_INFO or ORIG_PATH_INFO could work just as well. This stuff isn't magic. It either works or it doesn't work for specific reasons. The important thing is, with each change you make, to know the impact of the change and why it needs to be what you set it to. Working Mod Rewrite setup - El Forum - 10-28-2008 [eluser]tdktank59[/eluser] True... However like I said this is what I how I got it to work for myself... For most it will be for there local dev box that they have to screw with apache so yeah. Im still learning that sort of stuff and its making more sense but for someone who wants to get there dev box working with mod rewrite this will make it work fast and easily. Working Mod Rewrite setup - El Forum - 10-28-2008 [eluser]Colin Williams[/eluser] Make sure you take the time to learn it. Knowing how your server works isn't exactly trivial. Working Mod Rewrite setup - El Forum - 10-28-2008 [eluser]tdktank59[/eluser] Thats my goal lol! Actually have a Dell PE 1850 next to me right now (off atm...) but im setting up a web server on it and learning all the little tid bits about it so its on the todo list! |