Mod_rewrite with folders in views [SOLVED] |
[eluser]Ludovic-r[/eluser]
Hi everyone, Just wondering how to delete properly the "index.php" from the url and use the mod_rewrite, I've turned the $config['index_page'] = 'index.php'; to $config['index_page'] = ''; It works and removes the index.php from the url BUT my links are broken now This is my folder structure : 1-Views 2-front_end 3-templates.php (my php files) - css folder - js folder - images folder Do you have an idea of what kind of code should I put in my .htaccess to get this work? I've tried some in this forum but nothing work. Any help would be very very appreciated!! Thanks!
[eluser]beaufrusetta[/eluser]
You can start by implementing the HTACCESS code found here: http://ellislab.com/codeigniter/user-gui.../urls.html As far as your structure for your views, they should be loaded by your controllers - there shouldn't be any direct access to them from a URL. Code: function controller_name() site.com/controller_name/ -> would load that view.
[eluser]Ludovic-r[/eluser]
Yeah, I know this but when I add the code in the .htaccess and remove the index.php in $config[‘index_page’] = ‘index.php’; the index.php is well removed from the url but my url didn't work anymore! My uri structure is http://sitename/controller/function/iD but without the index.php in, it doesn't work! Maybe it's because my view files are placed in a folder called "front_end" in the "Views" folder ?
[eluser]Zaher Ghaibeh[/eluser]
its not problem you can put your views where ever you want as long as you point to it correctly in your controllers .. i think the problem in your .htaccess file, have you tried to have this inside it Code: Options +FollowSymLinks -Indexes
[eluser]Ludovic-r[/eluser]
Hi, thanks for your answer but it still not work T_T 2 questions : - My .htaccess is located in my "Application" folder - I work on localhost It's a potential problem?
[eluser]Zaher Ghaibeh[/eluser]
you .htaccess file must be located at the root of your site not inside your application folder. for example : CI --APPLICATION --SYSTEM -index.php -.htaccess <---- here is your file ..
[eluser]Ludovic-r[/eluser]
Okthe .htaccess is well placed (in the root) and I have the code in it. But it still not work I really don't know why. Any ideas? By the way thanks for your time, it's very appreciated!
[eluser]Zaher Ghaibeh[/eluser]
have you tried to reload your site by restarting apache ?? i know this is something cant be believed but in windows sometimes things get messy ... plus can you provide me with your environment specifications ( OS , LAMP Software ... etc ) ..
[eluser]Ludovic-r[/eluser]
Yes, I've restarted Apache and MySQL. I'm on MAMP on a Mac OSX system, my Apache has the mod_rewrite enabled by the way so it should work.. To resume, when I remove the index.php in my config file it shows a Not found page but the url is rewrited..
[eluser]Zaher Ghaibeh[/eluser]
[quote author="Ludovic-r" date="1304776175"] To resume, when I remove the index.php in my config file it shows a Not found page but the url is rewrited..[/quote] can you give me how your url look like .. thanks |
Welcome Guest, Not a member yet? Register Sign In |