Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

.htaccess causing unwanted 403 error

 
   Web Hosting and Web Master Forums (Home) -> Webmaster RSS
Next:  Understanding RBLs  
Author Message
nospam40

External


Since: Nov 10, 2003
Posts: 7



(Msg. 1) Posted: Mon Nov 10, 2003 8:19 pm
Post subject: .htaccess causing unwanted 403 error
Archived from groups: alt>www>webmaster (more info?)

I have been using .htaccess to prevent hotlinking of images from my site and
it works well. However, I am switching to a new host (a dedicated server)
and when I upload the file in the httpdocs directory (named /html) I get a
403 error trying to access any file in the domain - not jut PNG, GIF, or JPG
as specified in the .htaccess file below:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
RewriteRule .*\.(gif|jpg|png)$ http://www.differentsite.com/hotlinkimg.jpg
[R,L]

I have tried to view the site with and without the www prefix, and with and
without specifying index.html (i.e.mysite.com AND mysite.com/index.html).
Any idea what the problem might be? Again this works fine on my old host
just as I have it here.

Thanks for any suggestions.

 >> Stay informed about: .htaccess causing unwanted 403 error 
Back to top
Login to vote
goodnews

External


Since: Oct 22, 2003
Posts: 28



(Msg. 2) Posted: Mon Nov 10, 2003 11:28 pm
Post subject: Re: .htaccess causing unwanted 403 error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Ken Jones" <nospam.RemoveThis@nospam.com> wrote in message
news:AMPrb.8974$P%1.7990187@newssvr28.news.prodigy.com...
 > I have been using .htaccess to prevent hotlinking of images from my site
and
 > it works well. However, I am switching to a new host (a dedicated server)
 > and when I upload the file in the httpdocs directory (named /html) I get a
 > 403 error trying to access any file in the domain - not jut PNG, GIF, or
JPG
 > as specified in the .htaccess file below:
 >
 > RewriteEngine on
 > RewriteCond %{HTTP_REFERER} !^$
 > RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
<font color=purple> > RewriteRule .*\.(gif|jpg|png)$ <a style='text-decoration: underline;' href="http://www.differentsite.com/hotlinkimg.jpg</font" target="_blank">http://www.differentsite.com/hotlinkimg.jpg</font</a>>
 > [R,L]
 >
 > I have tried to view the site with and without the www prefix, and with
and
 > without specifying index.html (i.e.mysite.com AND mysite.com/index.html).
 > Any idea what the problem might be? Again this works fine on my old host
 > just as I have it here.
 >
 > Thanks for any suggestions.
 >
 >


Here's a rewrite rule found on <a style='text-decoration: underline;' href="http://wsabstract.com/howto/htaccess10.shtml" target="_blank">http://wsabstract.com/howto/htaccess10.shtml</a>

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ <a style='text-decoration: underline;' href="http://www.mydomain.com/nasty.gif" target="_blank">http://www.mydomain.com/nasty.gif</a> [R,L]

I notice the asterisk in your last line. Maybe it isn't supposed to be
there. And the [R,L] is on the same line (unless that's the post's own line
break).

John
<a style='text-decoration: underline;' href="http://www.stnorberts.com" target="_blank">www.stnorberts.com</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: .htaccess causing unwanted 403 error 
Back to top
Login to vote
johnsmith

External


Since: Nov 09, 2003
Posts: 6



(Msg. 3) Posted: Tue Nov 11, 2003 6:17 am
Post subject: Re: .htaccess causing unwanted 403 error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?xyz.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ <a style='text-decoration: underline;' href="http://www.xyz.com/xyz.jpg" target="_blank">http://www.xyz.com/xyz.jpg</a> [R,NC]

make sure that all lines are complete...
You can also go to
<a style='text-decoration: underline;' href="http://www.htmlbasix.com/disablehotlinking.shtml" target="_blank">http://www.htmlbasix.com/disablehotlinking.shtml</a>
and use thier generator to make it with all of the correct links

James



Ken Jones wrote:
 > I have been using .htaccess to prevent hotlinking of images from my site and
 > it works well. However, I am switching to a new host (a dedicated server)
 > and when I upload the file in the httpdocs directory (named /html) I get a
 > 403 error trying to access any file in the domain - not jut PNG, GIF, or JPG
 > as specified in the .htaccess file below:
 >
 > RewriteEngine on
 > RewriteCond %{HTTP_REFERER} !^$
 > RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
<font color=purple> > RewriteRule .*\.(gif|jpg|png)$ <a style='text-decoration: underline;' href="http://www.differentsite.com/hotlinkimg.jpg</font" target="_blank">http://www.differentsite.com/hotlinkimg.jpg</font</a>>
 > [R,L]
 >
 > I have tried to view the site with and without the www prefix, and with and
 > without specifying index.html (i.e.mysite.com AND mysite.com/index.html).
 > Any idea what the problem might be? Again this works fine on my old host
 > just as I have it here.
 >
 > Thanks for any suggestions.
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: .htaccess causing unwanted 403 error 
Back to top
Login to vote
nospam40

External


Since: Nov 10, 2003
Posts: 7



(Msg. 4) Posted: Tue Nov 11, 2003 8:21 pm
Post subject: Re: .htaccess causing unwanted 403 error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > make sure that all lines are complete...
 > You can also go to
<font color=purple> > <a style='text-decoration: underline;' href="http://www.htmlbasix.com/disablehotlinking.shtml</font" target="_blank">http://www.htmlbasix.com/disablehotlinking.shtml</font</a>>
 > and use thier generator to make it with all of the correct links

Thanks for the suggestion!<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: .htaccess causing unwanted 403 error 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Help with .htaccess and 404. - Hi, In my .htaccess I have ErrorDocument 404 /Error404php.php And it works fine, but how do I know what page the user was looking for and was not found? lately my logs show 100's of 404, (a lot more than usual), so I suspect it is my fault but without...

How to talk to htaccess via web form? - Hi everybody, Many thanks for replies to my other question! Here is another thing I need to do. I have a directory where we need to set htaccess to let user login. all the usual .htaccess stuff are in place so when the page is requested, a generic..

.htaccess perl login script ? - Hi, I would like to use a htaccess / htpasswd access restriction on my site but would like to replace the username/password popup with a standard form input (user & pass field + login button) on a web page. I could not find a perl script that wou...

dynamic to static url using mod_rewrite in.htaccess - I am trying to use a module for an ecommerce site that uses the mod_rewrite in .htaccess. The .htaccess is working when I use it for an "error 404", but not when I uncomment the rest of the file to change the dynamic to static urls. It gives me...

.htaccess - batch rewrite/ redirect? - I've just taken over a nightmare of a site for an animal rescue organization that has *over* 1500 pages, many of them in a static "yellow pages" directory. I'm really new to manipulating .htaccess files, and I was wondering if there's a way to...
   Web Hosting and Web Master Forums (Home) -> Webmaster All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]