htaccess and image paths

#1
[eluser]Unknown[/eluser]
Hello all

I'm very new to codeigniter and I'm sure this has been answered many times but I cannot seem to find the answer.
I have my CI organised as follows
system
licence.txt
htdocs
index.php
.htaccess
assets
images
image1.gif
application
....

In the .htaccess file I have
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

I have a controller called hello, which simply loads a view with $this->load->view('mainview.php');
The view file has the following
<img src="&lt;?php echo base_url(); ?&gt;assets/images/image1.gif" /> Test

When I view this in a browser, via http://mytestsite.co.uk/hello I cannot see the image. If I remove the RewriteRule in .htaccess and go to http://mytestsite.co.uk/index.php/hello I can see the image.
Can somebody please advise if
a) The directory structure I have above is correct.
b) How to remove/hide index.php from url, but have the image included.

Thanks in advance
Andrew

#2
[eluser]n0xie[/eluser]
Try this .htaccess:

Code:
<IfModule mod_rewrite.c>

    RewriteEngine On

    RewriteBase /



    #Removes access to the system folder by users.

    #Additionally this will allow you to create a System.php controller,

    #previously this would not have been possible.

    #'system' can be replaced if you have renamed your system folder.

    RewriteCond %{REQUEST_URI} ^system.*

    RewriteRule ^(.*)$ /index.php/$1 [L]



    #Checks to see if the user is attempting to access a valid file,

    #such as an image or css document, if this isn't true it sends the

    #request to index.php

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>



<IfModule !mod_rewrite.c>

    # If we don't have mod_rewrite installed, all 404's

    # can be sent to index.php, and everything works as normal.



    ErrorDocument 404 /index.php

</IfModule>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.