Recent Topics

1 Mar 01, 2007 20:51    

My b2evolution Version: 1.9.2

Hi all,
I have been trying to solve the following problem for the past few hours, looking through the source files and trying different configurations. I found lots of useful information in this forum, unfortunately nothing that helped me with this:

The URL redirection after a visitor leaves a comment is busted. Instead of going back to the root index.php, it stays in the htsrv folder.
Here is a sample URL that I get redirected to:

http://www.cowchickenbell.com/htsrv/%2Findex.php%3Fblog%3D2%26title%3Dtest%26page%3D1%26more%3D1%26c%3D1%26tb%3D1%26pb%3D1%26disp%3Dsingle#c23

For some reason it replaces all the characters with their URL syntax. The comment gets posted, but the above redirection URL naturally throws a 404 error. Have any of you run into this before and/or know a fix?

The software is at http://www.cowchickenbell.com/ if you want to take a look at it.

Thanks a lot,
FTK

Edit: entered b2e version.

2 Mar 02, 2007 18:42

There seem to be two things happening: For one thing redirect_to seems to include the htsrv directory for some reason and it doesn't decode the URL syntax for the characters.

My temporary fix is to decode the redirect_to and append it to the baseurl:
Original code:


// Append anchor to the redirect_to param, so the user sees his comment:

$Request->param( 'redirect_to', 'string', '' );

$redirect_to .= '#'.$Comment->get_anchor();

Replaced with:


// Append anchor to the redirect_to param, so the user sees his comment:
// This is not working correctly, let's see if I can set the URL manually - FTK 3/2/07
$Request->param( 'redirect_to', 'string', '' );

 //$redirect_to .= '#'.$Comment->get_anchor();
		
//decode URL
$redirect_to = str_replace('%2F', '/', $redirect_to);
$redirect_to = str_replace('%3F', '?', $redirect_to);
$redirect_to = str_replace('%3D', '=', $redirect_to);
$redirect_to = str_replace('%26', '&', $redirect_to);

$redirect_to = $baseurl.$redirect_to.'#'.$Comment->get_anchor();

If anybody can come up with a better fix for this, please let me know. Thanks.

3 Mar 02, 2007 21:37

I suggest restoring the file and turning off the clean URL feature. I'm not sure what your server needs to make that feature work properly, but when the server isn't as-needed problems can manifest themselves in a variety of different ways. One of them, if I recall correctly, is very related to comments and permalinks. Another is the "read more" link, but that might not be totally accurate.

Anyway if you restore the file and turn off that feature you might find that the comment system works as one would expect. IF this is the case then you know why you need the hack you've come up with. A hack that obviously works since I just left a comment on your blog.

4 Mar 02, 2007 22:29

Hi EdB,
I originally had the clean URL feature turned off. I actually tried all the different settings and all of them had the same problem. The sample URL I posted in my original post is actually with the clean URL feature turned off (index.php?blog=blahblahblah). I also tried messing with a lot of different files and ended up diving deep into the code -- which by the way is well commented, I was pleasantly surprised.

After I couldn't get it to work by changing the settings I decided to write this little hack to fix it. Then I turned on the clean URL feature again.

I am going to try to mess with this some more next week (I am a naughty boy and work on private stuff at work ;) ). If I find a different solution or I run into other problems I'll post them here.

Thanks for your reply,
FTK

5 Apr 12, 2008 07:34

I know this is a very old thread, but I was wondering if anyone had any idea what file the above mentioned coding can be found in, so I can see if the edited code works?

I'm having the same issue as the OP. Or does anyone know of another way of fixing the problem?

6 Apr 14, 2008 16:30

purple_ivy wrote:

I know this is a very old thread, but I was wondering if anyone had any idea what file the above mentioned coding can be found in, so I can see if the edited code works?

I'm having the same issue as the OP. Or does anyone know of another way of fixing the problem?

The file was /htserv/comment_post.php around line 320.


Form is loading...