Forum OpenACS Q&A: /www in URLs returned from Search

Collapse
Posted by tammy m on
Well I finally got Search and Static Pages installed! :)

But now on my Search results page the URLs are all broken. They include the /www directory in the path and that causes a URL not found error.

For instance the Search returns the URL as
http://www.mydomain.com/www/index.html
when the URL should be
http://www.mydomain.com/index.html
I'm sure I'm missing something stupid here?! Thanks for getting me over the last hurdle with Search (I hope it is the last anyway).

Collapse
Posted by Matthew Geddert on
its a bug - i fixed it but it dave must not have included it in the release... the fix is on this page: /packages/static-pages/static-pages-sc-procs.tcl

Edit the static_page__url proc to this... and restart-aolserver.

ad_proc static_page__url {
    object_id
} {
    @author Dave Bauer (dave@thedesignexperience.org)
} {

    db_1row sp_url ""
    set url "${url}"
    set url "StArT$url"
    regsub -all "StArT/www" $url " " url
    regsub -all ".html" $url " " url
    regsub -all ".htm" $url " " url
    set url "$url "
    regsub -all "/index " $url "/" url
    set url [string trim $url]
    return $url
}
Note, if you want the .html or .htm to show up on the searches remove the two lines dealing with those from this proc
Collapse
Posted by tammy m on
Thanks so much. Works beautifully now:)

As a side note; The file to edit is in $OPENACS_ROOT/packages/static-pages/tcl/static-pages-sc-procs.tcl (under the tcl directory in static-pages).

Collapse
Posted by Matthew Geddert on
i'm glad its working! and yes, i meant to say it was in the tcl directory...
Collapse
Posted by Rich Graves on
Shouldn't you be using string map instead of regsub? Or does that no longer apply? I have a dim memory of performance problems and memory leaks in regsub.
Collapse
Posted by Matthew Geddert on
i haven't had problems with memory leaks (yet??) on two production sites that don't get incredibly much traffic (only around 400 unique visitors on one per day and 50 on the other)... Do you recall where you read about this?

I do know that regsub is found all over the core of openacs...