Forum Moderators: phranque
Searching around the web this seems to relate to rewrite rules? Could somebody be so kind to check mine and see what's triggering this?
RewriteEngine on
RewriteBase /RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]RewriteRule ^([^/]*)\.html$ $1.php?%{QUERY_STRING} [NC]
#new rule below
#RewriteRule ^brand/([^/]+)/page([0-9]+)\.html$ index.php?manufacturers_id=$1&page=$2 [L]
RewriteRule ^brands/([^.]+)\.html$ brands.php?letternum=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^brand/([^.]+)\.html$ index.php?manufacturers_id=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^brands/([^.]+)\.html$ brands.php?letternum=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^product/([^.]+)\.html$ product_info.php?products_id=$1&%{QUERY_STRING} [NC,L]
#RewriteRule ^category/([^.]+)/page([0-9]+)\.html$ index.php?cPath=$1&%{QUERY_STRING}&page=$2 [NC,L]
RewriteRule ^category/([^.]+)\.html$ index.php?cPath=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^offer/([^.]+)\.html$ offer.php?products_id=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^type/([^.]+)\.html$ type.php?type=$1&%{QUERY_STRING} [NC,L]
RewriteRule ^new/([^.]+)\.html$ brand_newbrands.php?type=$1&%{QUERY_STRING} [NC,L]
You need a copy of Mozilla Firefox and you need to add the Live HTTP Headers extension to it.
Once done, start the extension and then attempt to access a page on your site.
Look at the Headers window and see that you get redirected to another URL and then redirected to another URL and then redirected to another URL and then redirected to another URL and then redirected to another URL and then redirected to another URL and so on.
The ordering of your rules is important. You should have the most specific first, and it should deliver you directly to the destination URL, not to another URL that is then the subject of another of your rules.
It would be helpful to know what URL you're requesting to get the internal recursion.
These are lower down in my htaccess, could these be it?
SetEnvIfNoCase User-Agent "Baiduspider" bad_bot
Order Allow,Deny
Allow from all
Deny from env=bad_bot<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from amazonaws.com
deny from 210.224.177.<Limit GET POST>
order allow,deny
allow from all
deny from ip address
deny from .af
</Limit><Limit PUT DELETE>
order deny,allow
deny from all
</Limit>ErrorDocument 404 /404.php
ErrorDocument 403 /403.shtml
ErrorDocument 401 /401.php<Files *.ini>
Order Deny,Allow
Deny from all
</Files>
RewriteCond %{HTTPS_HOST} !^www\.mysite\.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteRule (.*) [mysite.com...] [R=301,L]RewriteCond %{HTTP_REFERER} (10.20.x.x) [NC,OR]
RewriteCond %{HTTP_REFERER} (10.166.x.x) [NC,OR]RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?mysite\.com [NC]
RewriteRule \.(gif¦jpeg¦jpg¦bmp¦mp3)$ - [NC,F]RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?mysite\.com [NC]
RewriteCond %{QUERY_STRING} &?img=[^&]+ [NC]
RewriteRule ^product_thumb\.php$ - [F]
It would be helpful to know what URL you're requesting to get the internal recursion.How do I find that out?
The only thing I see wrong in here is this:
RewriteCond %{HTTPS_HOST} !^www\.mysite\.com
Jim
I also had:
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?mysite\.com [NC]
RewriteCond %{QUERY_STRING} &?img=[^&]+ [NC]
RewriteRule ^product_thumb\.php$ - [F]
I removed the line with:
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
As if I understand g1smd correctly, https? searches for both http & https.
To sum up, these are the two lines I removed:
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
RewriteCond %{HTTPS_HOST} !^www\.mysite\.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteRule (.*) [mysite.com...] [R=301,L]
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http?://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?mysite\.com [NC]
RewriteCond %{QUERY_STRING} &?img=[^&]+ [NC]
RewriteRule ^product_thumb\.php$ - [F]
I cleared my apache error logs.
Clicked a couple of pages, nothing. Waited a bit and spotted one.
I compared the visitor's IP to my access log.. their referral was Google images.
The only connection I noticed was this line from htaccess:
RewriteCond %{HTTP_REFERER} (images) [NC,OR]
..this is toward the bottom of my htaccess. Any idea what's wrong with this?