help with the /index.php/

fuz2013

Joined: 2013-02-06
Posts: 10
Posted: Fri, 2014-06-27 07:19

hi all,
this may seem kind of complicated, so bare with me.

ok i also run a project honey pot (for spam)and i have it set up where certain ip addresses and referrers get served a 302 status in my Cpanel logs.
so if an ip or spammer gets a 302 message it gets redirected to my honey pot file.
this setup has worked flawless for over 3 months.

Now, i have Installed the gallery 3 into a sub folder with its own htaccess file.

the path is like this "public_html/sub-folder/gallery3/"

I have un-commented and set up the following to get rid of the /index.php/ in the gallery3 url.

Quote:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /sub-folder/gallery3/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]
</IfModule>

this did work fine, no crashes or server errors, But i did come across an issue.
as i have been adding new albums, and photos i have not payed much attention to my Cpanel logs.

until today when i noticed i was getting a lot of 302 messages in cpanel.
with every album visit it generated a 302 status message, which in turn sent my own IP address
to my honey pot.

now i've been hunting this down for a while, and here is what i am suspecting is going on...
as i added albums and uploaded photos id return to the album.
this is an example of the page id get the 302 from, "Gallery3/album_name?show=272" and a referrer
of "gallery3/album_name/new album name " (no " ")

normally when you get a call like album_name?show=272
aren't you supposed to have an index.php in there somewhere ?

its not causing stability issues of gallery3,its just annoying with all the 302 that's generated.
and i don't want my ip address being put on project honey pot for all the visits counts i create.
Does this seem like something to do with the above code in the htaccess file ?
and if it is, any idea how to fix it ?

thanks for any input on this.

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2014-06-27 14:59

Without getting into whether you should or shouldn't do whatever you do with your redirects, try changing the last four lines to:

RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,R=permanent,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,R=permanent,L]
RewriteRule ^index.php/(.*) $1 [QSA,R=permanent,L]
</IfModule>
 
fuz2013

Joined: 2013-02-06
Posts: 10
Posted: Fri, 2014-06-27 18:01

hi, thanks for the reply,
i tried what you suggested but the

Quote:
R=permanent

killed the site.
with a

Quote:
Your browser sent a request that this server could not understand. 404 error

i removed the

Quote:
R=permanent

from the code and gallery3 worked again.
but on visiting the site again i got another 302 message when i clicked the random image.
it still showed the image but generated the 302 status code.

i did make some changes in my root htaccess file and the 302 is no longer putting my ip in the honeypot.
it only shows in the cpanel last visit logs. (which is livable now that my ip is not getting caught)
but would still like to try to nail the cause of the 302.
thanks

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2014-06-27 18:17

There's no question as to why you're getting a 302: it's because those lines of the htaccess are a redirect and redirects are 302 by default; it's SUPPOSED to do that.

I've never used a PT and a R in the same line, so I suspect the error is because of the PTs, but don't know for sure and don't have your server to look at so... (And no, don't remove the PTs; they're needed.)

You can try just leaving the modified 3rd line and not modifying the first 2.

 
fuz2013

Joined: 2013-02-06
Posts: 10
Posted: Fri, 2014-06-27 22:55

I have no clue what the QSA,PT is even for.
(im only familiar with some of the very basics)

But thanks for pointing out that 302 is the default,
i honestly did not know that, i just assumed the server handled it.
and i never see this happen with any other scripts i used before.
(forums, video galleries etc)

I do have a few redirect rules with only R not like R=302 or whatever number
so that explains why im seeing the 302's that i am.
thanks.