| Author
|
Thread |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
.htaccess error
When I first setup HackerTrap, part of the code for redirecting some pages was wrong. Now, every time the program updates .htaccess, it puts in the wrong code. I have tried changing the code in the control panel and reinstalling .htaccess, but it always reverts on the next update. Is the old .htaccess saved in the MySQL database? If so, how do I fix it?
Thanks.
|
Tue May 22, 2007 12:00 pm |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
(Answered via email; included here for reference)
Sorry to hear about the problems.
I'm not sure I understand the problem. You said you had an
initial error in htaccess before installing HackerTrap. Did you
delete that error? Hackertrap preserves the htaccess entries
before the hackertrap header. Does the error appear there?
One thing that should resolve it: Rename htacces to .htaccess.sav, then rerun hackertrap and install the generated htaccess file. That should start from a clean slate. If you have entries you want to add, place them first in the file above the hackertrap header.
Dennis
|
Wed May 23, 2007 9:21 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Re: .htaccess error
Here is what happens. The first line of my old .htaccess file was:
RedirectMatch 301 (.*).html$ http://www.godandscience.org$1.php
It should have been:
RedirectMatch 301 (.*)\.html$ http://www.godandscience.org$1.php
If I change the code in the control panel to include the "\", and install it, it gets changed back every time Hackertrap bans another IP address. I even changed the .htaccess.bak file to include the "\", but Hackertrap keeps reverting that file also. Does Hackertrap store the old part of .htaccess in the MySQL database file? Does it fetch that data every time it rewrites .htaccess? If so, it seems that Hackertrap is not updating MySQL when the user installs a changed .htaccess file from the control panel. It is the only thing I can figure that would cause the first line to keep reverting.
I tried your suggestion, but it didn't work (same problem).
|
Thu May 24, 2007 1:24 pm |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
HackerTrap reads .htaccess each time to generate the new .htaccess, so each time it rebuilds it from the original. I'm assuming your lines are above the HackerTrap comment marker in htaccess.
Please try two things for me:
1. When you press the "Install" button from within HackerTrap, does it create htaccess correctly?
2. Can you check if its seeing your new lines by modifying some other character? I think the backslash might be causing an issue -- can you change the line from "html" to "htm" and see if that change is recognized? (You can change it back afterwards; I just want to see it recognizes the change).
You should be able to work around the issue by removing the "\." completely and leave it as "html". The $ indicates its at the end of the string and should match. (I still need to correct it, just trying to get you going sooner).
Dennis
|
Mon May 28, 2007 9:35 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Re: .htaccess error
Yes, it does record it correctly, when you push install. However, the backslash disappears when it bans another IP address (auto updates). Everything else seems to be saved when you install it, so it seems to be a backslash issue. Leaving out the backslash means that links to my couple .shtml files get forwarded to .php, causing a 404 error.
Thanks for fixing it. Just let me know when you get a patch. Otherwise, the program works very well.
|
Tue May 29, 2007 1:53 am |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
I am going to have a look ... don't know why it would work from the Install and not automatically ....
Dennis
|
Tue May 29, 2007 10:13 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Moved to a new server
I moved my site to a new server (CP move) and it is giving an error:
code: Warning: fopen(/home/godan/public_html/.htaccess_pend) [function.fopen]: failed to open stream: Permission denied in /home/godan/public_html/HackerTrap/unlockit.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(4) : runtime-created function on line 84
code: Warning: fwrite(): supplied argument is not a valid stream resource in /home/godan/public_html/HackerTrap/unlockit.php(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(1) : eval()'d code(4) : runtime-created function on line 84
|
Mon Jun 04, 2007 1:04 pm |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
Godan,
This error comes about because you do not have write access to the root directory. HackerTrap cannot write out the temporary htaccess file.
You said you moved your site. Did you run the install scripts again? They check to ensure the directory is write-enabled--- did it give you the all clear?
Dennis
|
Mon Jun 04, 2007 10:07 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Re: .htaccess error
Everything should have been moved exactly as it was on the previous server. However, running the installation program gives an error creating the temporary directory. Your installation instructions don't say what to do if you get the error. How do you fix it?
Error: code: chmod testdir failed!Cannot create test directory!
|
Tue Jun 05, 2007 11:57 am |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
Godan,
What is the directory mask on public_html directory? It should be 755 - check it to see.
|
Tue Jun 05, 2007 7:26 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Re: .htaccess error
I changed it to 755, but it still has the error.
|
Tue Jun 05, 2007 7:46 pm |
|
|
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
Godan,
I looked at the problem, and it is definitely something with the permissions of the directory.
Can you verify the owner of the public_html directory is you? And that its permissions are 0755?
There is a very simple script in your root directory that attempts to create a file in the root directory, and it does not work due to permissions.
Dennis
|
Fri Jun 08, 2007 10:51 pm |
|
|
Godan
Joined: 22 May 2007
Posts: 7
|
Re: .htaccess error
Yes, I am the owner, and the permissions are 755 for public_html. However, the Group was "99", which I changed to be the same as owner. It doesn't seem to have fixed the problem, though, since it still gives the unable to create the file error (same for your testor program). Could it be some problem with PHP?
|
Tue Jun 12, 2007 12:12 pm |
|
|
dennis
Site Admin
Joined: 12 Nov 2006
Posts: 62
|
Re: .htaccess error
I don't know. I am stumped.
Try this: change the permission on the dir public_html to 777 and see if the test program works. I believe it will. Then reset it to 775 and test again. Restore it to 755.
The only other thing I can suggest is to open a problem ticket with your hosting company. I think it should works as 755.
Dennis
|
Tue Jun 12, 2007 10:54 pm |
|
|