Badly formed URL when searching forum posts

nickistre - November 4, 2006 - 01:32
Project:UIE Forum
Version:5.x-1.x-dev
Component:Search
Category:bug report
Priority:normal
Assigned:zoro
Status:closed
Description

This one comes when searching through forum posts. It correctly finds posts, but the URLs created for them are not created correctly.

For example, I have a forum topic with "This is a test" as a title at "http://www.example.com/forum?c=showthread&ThreadID=19"

When using the search function to look for test, it does find the topic, but the link to the post is set at "http://www.mediasnobs.com/uieforum%2526c%3Dshowthread%2526ThreadID%3D19"

I narrowed it down to uieforum.module on line 1847 where it shows:
            $find[] = array('link' => url(uieforum_get_module_menu_name() ."&c=showthread&ThreadID=".$row->ThreadID),

I am unable to fix this at all, as it seems drupal tries to clean up the following characters: '&', '=', and even '?'.

Looks like the slash ('/') is not cleaned up in this matter. It might be best at this point to move to clean URLs for the forums to get the search to work.

#1

nickistre - November 4, 2006 - 01:41

Oh, by "clean" URLs, I mean that the threads can be accessed via http://www.example.com/forum/c/showthread/ThreadID/19 instead.

#2

zoro - November 10, 2006 - 07:40

Yeah I was thinking of rewriting the module to work like that, but to be completely honest, even though it's clean, I don't like it :(
I'll look into it again though

#3

nickistre - November 10, 2006 - 20:26

Yay! I figured out a workaround if you have the rewrite module working in apache. In my .htaccess file in the drupal root directory, I added the following before the "# Rewrite current-style URLs of the form 'index.php?q=x'." line:

#RewriteRule to let the search engine point to a post correctly
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^uieforum/forumthread/(.+) uieforum?c=showthread&ThreadID=$1 [nc]

In modules/uieforum/uieforum.module, I modified line 1847 to show:
$find[] = array('link' => url(uieforum_get_module_menu_name() ."/forumthread/".$row->ThreadID),

Now the uieforum search will work, but the forum URL will work as normal (outside of the search paths).

#4

harro - March 13, 2007 - 11:43

Hi there - could you confirm that this works as you described? I get all resulting links in the format /forum/forumthread/4 as the URL. When I click these I always end up at the Forum root (i.e. it shows the different forums, not the actual message thread). The UIE forum does not understand /forumthread/ ... I have clean url's on for the rest of the site.

Howcome this works for you? Confused :)

Thanks for your feedback!

bye,

Harro

#5

harro - March 13, 2007 - 11:47

Okay! sorry for the page-soiling - found the cause and it works like a charm now:

the UIE forum on my site is not on /uieforum/ but on /forum/, so my code in .htaccess becomes:

RewriteRule ^forum/forumthread/(.+) forum?c=showthread&ThreadID=$1 [nc]

Just for the record, in case someone else has modified their UIE forum url.

#6

zoro - March 19, 2007 - 10:29

Nice addition - it may end up being an incredibly useful workaround for this module.

But there could be problems with it when it comes to replying/quoting/editing ... etc.
I'll look into it though.

#7

fellow - June 17, 2007 - 18:00
Version:4.7.x-1.x-dev» 5.x-1.x-dev

I had the same problem with v5. Thanks nickistre, your workaround does work again!

#8

zoro - June 18, 2007 - 15:56
Assigned to:Anonymous» zoro
Status:active» fixed

I've fixed the shoddy php code causing this error - it was caused by bad code that got migrated from the 4.6 version and has stuck there until now!

Thanks again guys,
Daniel

#9

vjuhasz - June 21, 2007 - 04:56
Status:fixed» active

Hi,

I noticed there is some bug in the URLs when the admin is deleting a post. The deletion goes well, but after the deletion the user gets redirected to a "Page not found" because of mis-formatted URL.

This is the URL before the deletion (seems to have some 'q' in it, might have to do with clean URLs?)
http://www.thetaconnections.net/admin/content/uieforum/edit/post/27?dest...

This is the URL after the deletion, which shows 'Page not found'
http://www.thetaconnections.net/q%3Duieforum

Cheers, Val

#10

zoro - June 21, 2007 - 06:57

Not anything to do with searching though, is it? :)

This is a known bug - I haven't bothered fixing it yet, as the admin stuff still works, it just doesn't redirect you correctly.
I definitely know about it :) Thanks!

#11

zoro - July 18, 2007 - 12:21
Status:active» fixed

#12

Anonymous - August 1, 2007 - 12:29
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.