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 stopping safecracker from doing its thing on home page

February 08, 2013 5:22pm

Subscribe [1]
  • #1 / Feb 08, 2013 5:22pm

    ahmad saad

    364 posts

    I am having an issue where the htaccess seems to be messing up the safecraker from, when i press submit the page just refreshes and the content is not added to EE.

    Here is the htaccess code (I put the system in sub dir /dev/alo001/):

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

    more info:  Admin > General Configuration is the field for “Name of your site’s index page” is empty

    the site groub template is the home page group
    the odd thing that when I go to the home page http://mydomain.com/dev/alo001/ the form the page just refreshes and the content is not added to EE.
    but if I go to http://mydomain.com/dev/alo001/site/  it’s work fine!!!!!!!!!!!

    I hope this will be clear.

    Thank’s,
    Ahmad

  • #2 / Feb 08, 2013 5:49pm

    Try using the following .htaccess:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php from ExpressionEngine URLs
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
  • #3 / Feb 08, 2013 6:01pm

    ahmad saad

    364 posts

    Thanks for the quick reply, Michael.

    but I have the same result, on the home page just refresh the page , if I go to the /site/ it works fine.

  • #4 / Feb 08, 2013 6:04pm

    So your index/home page should be accessible at: http://www.example.com/dev/alo001/site/?

    If so, is your config file set-up like so:

    $config['base_url'] = 'http://www.example.com/dev/alo001/site/';
  • #5 / Feb 08, 2013 6:26pm

    ahmad saad

    364 posts

    Hi Michael.

    the Site is a template group in CMS and it’s the site home group.

    so before remove index.php i go to it by http://www.example.com/dev/alo001/index.php/site/

    after remove index.php become http://www.example.com/dev/alo001/site/

    I go to the config file and the base_url value is empty, I try to add http://www.example.com/dev/alo001/  to it’s value but it not work the same problem is still appers.

    the odd thing as I post is when I got to the EE root http://www.example.com/dev/alo001/ the page just refresh but if I go to the Site template group (home group) the code work fine!!!!!!!!!!!

  • #6 / Feb 08, 2013 6:31pm

    Set config.php to:

    $config['base_url'] = 'http://www.example.com/dev/alo001/';

    Then Edit Template Group -> Site, and ensure “Make the index template in this group your site’s home page?” is checked.

  • #7 / Feb 08, 2013 6:36pm

    ahmad saad

    364 posts

    I go to the config file and the base_url value is empty, I try to add http://www.example.com/dev/alo001/  to it’s value but it not work the same problem is still appers.

    I do this already as I told you , and the site template group is the site home page , and the problem still there.

  • #8 / Feb 08, 2013 8:07pm

    ahmad saad

    364 posts

    any other ideas here please???

  • #9 / Feb 11, 2013 4:04pm

    ahmad saad

    364 posts

    more info when I do more test:

    the safecracker form action attr is http://www.example.com/dev/alo001

    when I try to hardcode it to http://www.example.com/dev/alo001/

    with the railing slash it’s work fine.

    I don’t know what’s the problem here??

  • #10 / Feb 11, 2013 6:44pm

    ahmad saad

    364 posts

    I have waited for a solution to my problem here a long time, but I haven’t got any thing.

    so I depend on my self and I dig & dig in EE core files and I find that the problem in :

    /expressionengine/modules/channel/mod.channel_standalone.php

    in line 503:

    $RET = (isset($_POST['RET'])) ? $_POST['RET'] : $this->EE->functions->fetch_current_uri();

    the function fetch_current_uri() remove the tailing slash.

    so if you have the same problem follow me:

    1- find the file /expressionengine/modules/channel/mod.channel_standalone.php .

    2- go to the line 996:

    $data = array(
          'hidden_fields' => $hidden_fields,
          'action'  => $RET,
          'id'   => 'publishForm',
          'class'   => $this->EE->TMPL->form_class,
          'enctype'   => 'multi'
          );

    3- add this code before it:

    $RET = $this->EE->functions->remove_double_slashes($RET.'/');   // Regards Ahmad saad .

    I hope this will be helpfull.

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

ExpressionEngine News!

#eecms, #events, #releases