0

我正在为一个朋友做一些网页设计,我注意到除了我正在工作的子目录之外,她网站图像上的其他任何地方都可以正常加载。我查看了她的 .htaccess 文件,果然它设置为拒绝人们窃取她的图像。足够公平,除了我正在处理的页面在她的域中,但我仍然收到 403 错误。我正在粘贴下面的 .htaccess 内容,但我用 xyz、123 和 abc 替换了域名。

因此,特别是我所在的页面(xyz.com/DesignGallery.asp)从(xyz.com/machform/data/form_1/files)中提取图像并导致禁止错误。

RewriteEngine on
<Files 403.shtml>
order allow,deny
allow from all
</Files>
RewriteCond %{HTTP_REFERER} !^http://xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://xyz.com/machform/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://xyz.com/machform/data/form_1/files/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://xyz.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://abc.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://abc.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://abc.xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://abc.xyz.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://123.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://123.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://123.xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://123.xyz.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xyz.com/machform/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xyz.com/machform/$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xyz.com/machform/data/form_1/files/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xyz.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.abc.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.abc.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.abc.xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.abc.xyz.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.123.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.123.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.123.xyz.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.123.xyz.com$      [NC]

RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
deny from 69.49.149.17
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^vendors\.html$ "http\:\/\/www\.xyz\.com\/Design_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^vendors\.asp$ "http\:\/\/www\.xyz\.com\/Design_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^ArtGraphics\.html$ "http\:\/\/www\.xyz\.com\/Art_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^ArtGraphics\.asp$ "http\:\/\/www\.xyz\.com\/Art_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^Gear\.asp$ "http\:\/\/www\.xyz\.com\/Gear_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^Gear\.html$ "http\:\/\/www\.xyz\.com\/Gear_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^NewsletterSign\-Up\.html$ "http\:\/\/www\.xyz\.com\/Newsletter\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^NewsletterSign\-Up\.asp$ "http\:\/\/www\.xyz\.com\/Newsletter\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^KidzStuff\.html$ "http\:\/\/www\.xyz\.com\/KidzStuff1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^KidzStuff\.asp$ "http\:\/\/www\.xyz\.com\/KidzStuff1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^Vendors\.html$ "http\:\/\/www\.xyz\.com\/Design_Gallery_1\.htm" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^Vendors\.asp$ "http\:\/\/www\.xyz\.com\/Design_Gallery_1\.htm" [R=301,L]
4

1 回答 1

0

我敢打赌它在其中一个指令中存在语法错误,您在替换 www.xyz.com 时可能已经更正了。

如果您有权访问 httpd.conf,则可以设置RewriteLogRewriteLogLevel指令以了解尝试加载图像时发生的情况。您应该能够很容易地识别出违规行。(完成后请务必删除这些指令。)

如果你无权访问httpd.conf,你可以逐行删除,直到找到违规者。

(一旦这一切都完成了,你可能会.htaccess稍微简化那个文件。大多数重写条件都是多余的。很容易让微小的错误潜入而不被注意到)

于 2010-04-10T13:23:28.790 回答