HMVC and Codeigniter problem |
[eluser]salvomil[/eluser]
Hi everybody, I started to use hmvc for codeigniter, and I have a problem when I try to display images in views. Maybe I don't know exactly how to set the configuration. My structure is the following: .. -application --modules -- mymodule -- controllers -- views -- ecc... -system -images --site -image.jpg -bla-bla-bla When I use controller in my module (http://localhost/codeigniter-hmvc/mymodule/welcome) it is all ok I can view the template and also orm datamapper is ok, but if I need to show an image, ie (http://localhost/codeigniter-hmvc/images/site/image.jpg) I can't see the image, I get error 404 page not found. Someone could help me? Thank you
[eluser]noideawhattotypehere[/eluser]
What your htaccess looks like? (the one in root folder, where index.php is, also is there any htaccess in your images folder?)
[eluser]salvomil[/eluser]
Thank you for the answer, I have to specify I used Codeigniter-skeleton 2.0. I have no .htaccess in image folder, and there is only .htaccess in root folder , the following: RewriteEngine on #Any HTTP request other than those for index.php, assets folder, files folder and robots.txt #is treated as a request for your index.php file. RewriteCond $1 !^(index\.php|assets|files|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L]
[eluser]salvomil[/eluser]
OK I found the problem thanks to noideawhattotypehere. In my .htacces there was no "images" and I added it so from RewriteCond $1 !^(index\.php|assets|files|robots\.txt) I modified the line to RewriteCond $1 !^(index\.php|assets|files|images|robots\.txt). Thank you.
[eluser]student101[/eluser]
Should this be standard for all? [quote author="salvomil" date="1390561729"]OK I found the problem thanks to noideawhattotypehere. In my .htacces there was no "images" and I added it so from RewriteCond $1 !^(index\.php|assets|files|robots\.txt) I modified the line to RewriteCond $1 !^(index\.php|assets|files|images|robots\.txt). Thank you.[/quote]
[eluser]jonez[/eluser]
If you use an .htaccess like this it won't rewrite real files so if you ever add other asset folders you won't have to change your rewrite: Code: RewriteEngine On
[eluser]student101[/eluser]
Thanks I'm still learning Codeigniter and my .htaccess knowledge is from perishablepress [quote author="jonez" date="1391367856"]If you use an .htaccess like this it won't rewrite real files so if you ever add other asset folders you won't have to change your rewrite: Code: RewriteEngine On |
Welcome Guest, Not a member yet? Register Sign In |