Welcome Guest, Not a member yet? Register   Sign In
HMVC and Codeigniter problem
#1

[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
#2

[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?)
#3

[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]
#4

[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.
#5

[eluser]noideawhattotypehere[/eluser]
Ur welcome, glad i could help you
#6

[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]
#7

[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
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#8

[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
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
[/quote]




Theme © iAndrew 2016 - Forum software by © MyBB