Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Guest Deleted

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!

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...