PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

rewrite links

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • rewrite links

    Hi there,

    i'ld like to start with saying this search software is truly awsome. So far, i'm quite happy with the results i managed to achieve with my limited knowledge of php etc.

    I mainly use the searchengine to find photo's in my photogalleries. Now, de resultlink allways points to a jpg in a blank new tab. Like this:

    ..photos/image.jpg

    i want the result links to be rewritten to this:

    ..index.php?autoload=image

    so that people still can use all the functionality.

    I've been able to replace photos/ with index.php?autoload= but the final .jpg in the link should be cleared to.
    Could you please help me on this issue.

    Thanks in advance,

    Jan

  • #2
    Unfortunately, the current "rewrite URL" feature is only able to rewrite one portion, as you described. So there isn't an easy way to get rid of the ".jpg" at the end of the URL. Perhaps we will consider changing this to support multiple rewrite rules in the future, if there is more demand (if anyone else needs this, please chime in).

    Is there any chance of being able to change "index.php" to allow the autoload= parameter to have a ".jpg" extension pre-specified? So it doesn't have to append it when it's already there.

    If you're comfortable with writing PHP, you could modify "search.php" to do something similar, but note that we are unable to provide support for any customized scripts so do so at your own risk.

    Make sure you back up the default script first as well before attempting this so you can revert to the original.

    Something like the following could work, but again, we provide no support for this, and I have not tested it.

    Look for the lines (there's more than one):

    Code:
    $url = $pgdata[$PAGEDATA_URL];
    And replace it with:

    Code:
    $url = $pgdata[$PAGEDATA_URL];
    if (strstr($url, "index.php?autoload=") !== FALSE)
          $url = str_replace(".jpg", "", $url);
    If this works for you, take a look at the "Custom script source path" (under "Configure"->"Advanced") option in the indexer to specify this alternative source file for your future re-indexings.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Sir you are amazing!!

      This works like a charm

      Comment


      • #4
        I'm also interested in more a sophisticated "Rewrite Links" option. My suggestion would be to support using Regex in the "Find in URL" field. In my case I'm switching my site from "http" to "https". I have "Rewrite Links" set to rewrite my base url (eg, https://example.com/) to "../". Ideally I'd like to be able to match for "https://example.com/" and also "http://example.com/". That would ensure that any links in my site (or within my Zoom settings, such as "Recommended") that I've missed converting to "https" will get replaced correctly.

        This isn't a huge need in that I've hopefully caught everything and made the manual changes I needed to. But more robust abilities (eg, regex) for the "Find in URL" field would be welcome.

        Comment

        Working...
        X