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.

.htaccess problems with Freeform and EE MSM

April 11, 2012 11:34am

Subscribe [1]
  • #1 / Apr 11, 2012 11:34am

    JamMan

    9 posts

    Hello,

    I’m trying to configure my .htaccess file accordingly with the use of Freeform and MSM, but don’t know how to, or where to find out.

    I’m running 3 sites (1 store and all sites are SSL secure)

    EE 2.4.0
    MSM 2.1.2
    Freeform 3.1.3

    2 of these sites require separate AJAX forms (not the store)

    I initially had the problem whereby my forms weren’t submitting (and returning to the wrong page).
    It wasn’t until reading this post:

    http://ellislab.com/forums/viewthread/199602/

    that I figured out it had something to do with my .htaccess file.
    I essentially have the exact same problem.

    Having followed the given advice and temporarily disabled it (changed .htaccess to htaccess) the form started working.

    However, the .htacess forces all my sites to be https and therefore I don’t want to keep it disabled.

    The .htaccess rules for the primary site is currently as follows:

    # Always use https for secure connections
    # Replace 'site.com' with your domain name
    # (as it appears on your SSL certificate)
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ <a href="https://www.myprimarysite.com/$1">https://www.myprimarysite.com/$1</a> [R=301,L]

    This is placed in the same location as the system and themes folders.
    The other two sites (including the store) are in their respective folders and they both have a .htaccess file in there as well.
    Their .htaccess files are essential the same (apart from the actual domains names)

    The store is a subdomain of the primary site: store.myprimarysite.com
    The 3rd site has its own domain: myseconddomain.com

    I have not configured my .htaccess to remove the index.php but ideally it would be good to implement this as well.
    I’m assuming its a matter of configuring my .htaccess file accordingly to location it is in?

    I hope I’ve provided enough information, any suggestions?

    Cheers

     

  • #2 / Apr 12, 2012 11:41am

    Dan Decker

    7338 posts

    Hi JamMan,

    I’m sorry you are having trouble with .htaccess!

    We offer one supported .htaccess solution for use with ExpressionEngine:

    <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 ^(.*)$ /index.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>

    With this in place, you should be in good shape. You will need a version of this in each MSM folder as well, modified slightly:

    <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 ^(.*)$ /msm-site/index.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>

    Note the change in RewriteRule where “msm-site” is the name of the folder for that particular MSM site.

    Let me know if that works for you!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases