Forums

[resolved] Search result exposes index.php in url (4 posts)

  1. Christine
    Moderator
    Posted 2 years ago #

    Hi there,
    Someone pointed out to me that my search form on one of my sites was exposing the index.php. My search results were being displayed as http://www.domainname.ca/index.php?s=crap&sbutt=Go

    I was using this:

    <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">

    and switched to this:

    <form id="searchform" method="get" action="<?php bloginfo('siteurl'); ?>">

    and now my search results appear as http://www.domainname.ca/?s=crap&sbutt=Go which I'm told is much better. But I can't figure out why. Why is removing the index.php from the url important? Can anyone point me to a document or a link explaining this? I searched on Google, but can't find anything.

  2. Tzaddi
    Member
    Posted 2 years ago #

    Sorry I can't answer this; it confuses me to. Since every WordPress install has an index.php I don't see why having it show up in the URL would be a problem. It's not like the file is top-secret :-D

    Really curious to hear what others who are more security-savvy than me have to say.

  3. Otto
    Tech Ninja
    Posted 2 years ago #

    There is no security risk there. Use whatever looks better to you.

    Also, you can get rid of the sbutt=Go by removing the "sbutt" name from the search button form. That might look even better, really.

  4. Christine
    Moderator
    Posted 2 years ago #

    Thanks for the answers guys. I should ask the person who mentioned this to me to clarify. As long as it's not a security issue, then I'm happy.

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic