![]() |
Mod Rewrite to rewrite *.html files - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Mod Rewrite to rewrite *.html files (/showthread.php?tid=31683) |
Mod Rewrite to rewrite *.html files - El Forum - 06-28-2010 [eluser]joshbuckley[/eluser] Hi, I'm developing a CMS with CI, and am having trouble getting the correct rewrite settings. My directory structure is as follows: Code: /cms (renamed from system) Now, what I want to do is have a designer do all their html/css/js etc, however they like, and be able to dump in the /cms, cms.php and .htaccess in the same directory to automatically CMS-ify the site. So, I need all html documents, ie index.html and page1.html, plus those in subfolders (except the cms folder) to be processed by CI. I have a route in CI that routes all requests ending in .htm or .html to an appropriate controller, which can load and process the file then output its contents. However, when an html file is currently accessed, CI doesn't get involved - this is because I'm using the .htaccess from the wiki - which allows access to any files which exist. Code: #Checks to see if the user is attempting to access a valid file, I need this to continue, with the exception of .htm and .html files which need processing. I'm guessing I need a RewriteCond below the two listed which excludes these files. I've had a go at doing it myself, but its not my strong point and I didn't get anywhere ![]() Any help would be much appreciated! Mod Rewrite to rewrite *.html files - El Forum - 06-28-2010 [eluser]joshbuckley[/eluser] As usual, after posting, I find the solution fairly quickly! Came up with this: Code: RewriteRule ^(.*\.html)$ cms.php?/$1 [NC] Incredibly simple. |