Jump to content
Larry Ullman's Book Forums

What Is Up With My .Htaccess And My Images?


Recommended Posts

Guest Deleted

I have a site that is on both a local and remote host. On the remote host, the images show up fine. On the local they only show up if I comment this out of my .htaccess: 

RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC] 

Both versions of the site use virtually the same .htaccess file. Why is it only causing a problem on the local host?

 

Other Info:

-Remote server is linux, local is windows

-Don't know what server software remote uses, local uses xampp

-Both sites are using the CodeIgniter framework

 

 

Thanks in advance!

Link to comment
Share on other sites

I would guess that it's because of the backslash (\). If you're in a Windows environment for your localhost, then the rewrite rule might take effect, but it won't on a public server, which is likely running a flavor of Linux/UNIX.

 

To be honest, I really don't know though.

Link to comment
Share on other sites

This is my .htaccess for Codeigniter:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|assets|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

It routes everything to index.php (remote index.php in CI config) but ignores the folders images, assets and uploads. Give it a shot.

  • Upvote 1
Link to comment
Share on other sites

Guest Deleted

I finally figured it out. It was messing up because of the lines immediately before. They were similar to this:

 

RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]

I changed them all the "mysite.com"* to "localhost".

 

It seems to be working pretty well now.

 

*Not my real domain name. PM me if you really, really want to know it.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...