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.

Remove 'index.php' from a simple search

August 12, 2011 4:52pm

Subscribe [2]
  • #1 / Aug 12, 2011 4:52pm

    Linedup

    42 posts

    Hi

    I have configured my site to work without index.php (via .htaccess etc). However the simple search module still returns the user back to a page with index.php.

    {exp:search:simple_form channel='writers' search_in='everywhere' show_future_entries='yes' result_page='site/search' no_result_page='site/no_search_results'}
      <input type=“text” name=“keywords” value=“Search…” id=“search” />
      <input type=“submit” id=“search-btn” />
    {/exp:search:simple_form}

    Is there anyway around this please?

    Thanks
    Jonathan

  • #2 / Aug 13, 2011 4:17pm

    Dan Decker

    7338 posts

    Hi there Linedup,

    When you removed index.php, did you follow the officially supported method? Can you share the contents of your .htaccess?

    Cheers,

  • #3 / Aug 13, 2011 7:34pm

    Linedup

    42 posts

    Thanks Dan

    I’m in a right old muddle. The site in question is:

    Mod Edit: Site details removed from public view for security

    I have to fit the EE site within an existing website (e.g. everything outside of /sixtysix/). So I have used the following .htaccess

    <IfModule mod_rewrite.c>
      RewriteEngine On
      # Removes index.php
      RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^sixtysix/(.*)$ /ee/expression_engine.php?/$1 [L]
      # If 404s, “No Input File” or every URL returns the same thing
      # make it /index.php?/$1 above (add the question mark)
    </IfModule>

    I have placed all the ee files within the ee folder and the frontend and admin areas work fine - job done.

    However my confusion lies in that unless I set the ‘site_url’ via Deeploy Helper to:
    http://bushtheatre.builtbybuffalo.com/ee/ then my stylesheets do not load. This is evident in the path to the css used in the header.

    The other setting that I am unsure about is:
    $config[‘cp_url’] = “http://bushtheatre.builtbybuffalo.com/ee/system/expression_engine.php”;

    I tried a workaround by setting this to http://bushtheatre.builtbybuffalo.com/sixtysix/ and then loading my css in from a static file. This does work as expected.

    So in theory I have 2 working models to run with. However the problem is when I run a search and it uses the path set in the ‘site_url’ (either er or sixtysix). The ee version actually works, however the /sixtysix is then lost in the URL. I can live with this as every link away from this page redirects back to /sixtysix.

    All rather confusing and I was wondering if you had any advice / experience in the best practices here please. Project deadline is 3 days away, so mild panic is setting in.

    Many thanks, Jonathan

  • #4 / Aug 13, 2011 7:40pm

    Linedup

    42 posts

    For the record I have now renamed expression_engine.php to index.php (for security).

  • #5 / Aug 13, 2011 7:55pm

    Linedup

    42 posts

    Another update..
    I have now put back all the other rewrites from the main site and whilst the pages all work fine (as these use /sixtysix), the search kicks me back to the main site as this uses the following domain, which is not caught by the rewrite rule (hence my need to get it corrected):
    http://bushtheatre.builtbybuffalo.com/ee/index.php

  • #6 / Aug 15, 2011 6:24pm

    Dan Decker

    7338 posts

    OK Linedup,

    Let’s take a step back and get a handle on exactly where we are, and what you are trying to achieve. To start, I should have asked earlier, what version of ExpressionEngine are you using? I understand that you are trying to integrate ExpressionEngine into an existing site, let’s say http://example.com/ You have ExpressionEngine installed at http://example.com/ee/ and you issue is that any searches are being routed back to the main example.com site? So, if you go to http://example.com/ee/search/ and enter a search term, you are directed back to http://example.com/ *instead* of seeing a results page at http://example.com/ee/search/results/

    One thing to note: spending on your version, $config[‘cp_url’] should point to /system/index.php or /admin.php That item tells ExpressionEngine where to locate the Control Panel and should have no affect on the public presentation.

    Help me get a clear picture of the situation and we’ll get moving towards a resolution.

    Best,

  • #7 / Aug 15, 2011 6:38pm

    Linedup

    42 posts

    Thanks for your response.

    Let me try to explain more clearly. The main existing website uses a lot of rewrites already, so I cannot simply point to the folder where ee is installed. Instead I use the following rewrite:

    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^sixtysix/(.*)$ /ee/index.php?/$1 [L]

    All the ee pages are served fine via the rewrite, as I prepend all the internal links with ‘/sixtysix’.

  • #8 / Aug 15, 2011 7:15pm

    Linedup

    42 posts

    Oh sorry I forgot to say - the EE version is 2.2.2

  • #9 / Aug 16, 2011 6:41pm

    Dan Decker

    7338 posts

    Linedup,

    I’m sorry to keep following up with more questions, but I need to know, are you getting results to display? Is it just that you want the results page to display without index.php? In Admin-> General Configuration what is the value of “Name of your site’s index page”? *If* it says “index.php”, clear that field and click “Update”.

    Don’t worry, these are the last questions I’ll ask. Next step will be for us to go in and have a look.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases