ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search loops through an empty URI?

October 27, 2009 8:56am

Subscribe [3]
  • #1 / Oct 27, 2009 8:56am

    Ville Walveranta

    72 posts

    When I submit a search page it ultimately results in an URL such as:

    http://mysite.com/search/results/f08b67a2424d1196308191a24a6f8d86/

    .. as I have set the result page to be /search/results.

    However, if I have the following rewrite in effect (to always add ‘home’ to the URL if no location name is provided):

    RewriteCond %{REQUEST_URI}      ^/$ [NC]
    RewriteRule ^/(.*)              <a href="http://www.mysite.com/home">http://www.mysite.com/home</a> [L]

    .. the search result page gets disabled: when I submit the search I end up to the home URL. Looking at the rewrite logs Apache mod_rewrite is matching a blank URI, i.e. just ‘/’, and so it gets redirected to ‘/home’. Yet when I disable the above rule the search result page (at a similar URL I mentioned above) is displayed. Why is this and is there some way to get around this?

    Moved to HowTo by Moderator

    Thanks!

  • #2 / Oct 27, 2009 9:22am

    silenz

    1651 posts

    The search form will actually POST to http://mysite.com/index.php or http://mysite.com/ if you remove the index.php by some means and redirect form there to http://mysite.com/search/results/f08...

    That has to be taken into account.

  • #3 / Oct 27, 2009 9:26am

    Ville Walveranta

    72 posts

    That explains why the URL disappears. Since the “result_page” variable doesn’t change the POST target, is there some other way to do so?

    Thanks for the info!

  • #4 / Oct 27, 2009 9:50am

    silenz

    1651 posts

    Probably not without hacks or a custom search module/plugin.

    If my memory serves me right there are no hooks in the search module.

  • #5 / Oct 27, 2009 11:15am

    Sue Crocker

    26054 posts

    Thanks for the assist, silenz.

    Ville, as silenz mentioned, it looks like you’re going to have to use some other method to achieve your goals. We don’t officially support the removal of index.php via .htaccess. Moving to HowTo for additional community support.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases