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.

Freeform does not work when index.php is removed

November 18, 2011 4:32pm

Subscribe [3]
  • #1 / Nov 18, 2011 4:32pm

    Eastwood Design

    605 posts

    I cant be the only one with this problem:

    I have used the .htaccess file to remove the index.php file, not freeform will not work at all.  Just redirects to the hoe page and nothing gets submitted.

    How do you get freeform to work with no index.php ?

    EE 2.2.2
    FF 3.0.3

    using NSM .htaccess Generator to remove the index.php file

    {exp:freeform:form
       collection="Contact"
       required="name|email"
       template="Contact"
       return="new_here/thank_you"
    recipient1="General Inquiry|[email protected]"  
    recipient2="General  Request|[email protected]"  
    recipient_limit="2"
    recipients="yes"  
    }
     
    Name: <input type="text" name="name" /></p>
    Email: <input type="text" name="email" /></p>
    Questions or Comments:
    <textarea name="question"></textarea>
    Select Recipient: <select name="recipient_email[]" >
       {recipients}
       <option value="{recipient_value}">{recipient_name}</option>
       {/recipients}
    </select>  
    
     
     
    {if captcha}
    Please enter in the word you see below: <input type="text" name="captcha" size="40" /></p>
    {captcha}
    {/if}
    
     
     
    <input type="submit" name="submit" value="Submit" /></p>
     
    {/exp:freeform:form}
  • #2 / Nov 18, 2011 6:58pm

    Mark Bowen

    12637 posts

    Freeform can definitely work with index.php removed as I do it on every site I ever create with ExpressionEngine.

    Have you tried using the index.php removal method shown here?

    Try taking the NSM .htaccess Generator out of the question for a bit and try that code out. I’ve used that on every single site and it works fine every time.

    Best wishes,

    Mark

  • #3 / Nov 18, 2011 7:10pm

    Eastwood Design

    605 posts

    Yes tFreeform works without my htaccess turned on

    This is my htaccess code that is from NSM htaccess generator and based on the Ee Include method http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method

    # For more awesome .htaccess rules and optimisations
    # checkout the HTML5 Boilerplate .htaccess files
    # <a href="https://github.com/paulirish/html5-boilerplate/blob/master/.htaccess">https://github.com/paulirish/html5-boilerplate/blob/master/.htaccess</a>
    
    # Although highly unlikely, your host may have +FollowSymLinks enabled at the root level,
    # yet disallow its addition in .htaccess; in which case, 
    # adding +FollowSymLinks will break your setup (probably a 500 error), 
    # so just remove it, and your rules should work fine.
    Options +FollowSymlinks
    
    # EE 404 page for missing pages
    ErrorDocument 404 /index.php/{ee:404}
    
    # Simple 404 for missing files
    <FilesMatch "(\.jpe?g|gif|png|bmp|css|js|flv)$">
      ErrorDocument 404 "File Not Found"
    </FilesMatch>
    
    # Rewriting will likely already be on, uncomment if it isnt
    # <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    # </IfModule>
    
    # Block access to "hidden" directories whose names begin with a period. This
    # includes directories used by version control systems such as Subversion or Git.
    <IfModule mod_rewrite.c>
      RewriteRule "(^|/)\." - [F]
    </IfModule>
    
    # remove the www - Uncomment to activate
    <IfModule mod_rewrite.c>
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    </IfModule>
    
    # Remove the trailing slash to paths without an extension
    # Uncomment to activate
    # <IfModule mod_rewrite.c>
    #   RewriteRule ^(.*)/$ /$1 [R=301,L]
    # </IfModule>
    
    # Remove index.php
    # Uses the "include method"
    # <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
    # <IfModule mod_rewrite.c>
    RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/({ee:template_groups}{ee:pages}members|P[0-9]{2,8}) [NC]
    RewriteRule (.*) /index.php/$1 [L]
  • #4 / Nov 18, 2011 7:33pm

    Mark Bowen

    12637 posts

    Is it possible to literally just try with the code from the documentation page and turn off the NSM extension and see if it works then?

    If that doesn’t work then maybe your server doesn’t allow for the removal in these ways and you might want to contact your host regarding this matter.

    Best wishes,

    Mark

  • #5 / Nov 27, 2011 11:55pm

    theoracle

    1 posts

    I’m facing the same problem now. Any solution how to make it works?

  • #6 / Nov 28, 2011 8:41am

    Eastwood Design

    605 posts

    Try changing these lines in the htaccess generator template:

    # remove the www - Uncomment to activate
    <IfModule mod_rewrite.c>
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    </IfModule>

    with this:

    # remove the www - Uncomment to activate
    # <IfModule mod_rewrite.c>
    #   RewriteCond %{HTTPS} !=on
    #   RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    #   RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    # </IfModule>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases