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.

Comments Not Working

May 24, 2012 5:02pm

Subscribe [2]
  • #1 / May 24, 2012 5:02pm

    timkelty

    177 posts

    Hi,

    I am running EE 2.5.0 and the comment module is not working properly when my site’s index page setting in the General Configuration is set to nothing (”“). Comment module works as it should when I restore this setting to the default “index.php” value.

    I have tried numerous things including:

    - emptying my .htaccess
    - using different values for the $config[‘uri_protocol’] variable
    - uninstalling and reinstalling the comment module
    - putting the comment form into it’s own template and hard coding the entry_id parameter
    - uninstalling all other addons
    - trying on a page with the “index.php” segment in the URL or without

    Not sure what else to try. Any help would be appreciated.

    Thanks!

    {exp:comment:form channel="comment_test" entry_id="2"}
      {if logged_out}
        <label for="name">Name:</label> <input type="text" name="name" value="{name}" size="50" /><br >
        <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br >
        <label for="location">Location:</label> <input type="text" name="location" value="{location}" size="50" /><br >
        <label for="url">URL:</label> <input type="text" name="url" value="{url}" size="50" /><br >
      {/if}
      <label for="comment">Comment:</label>
    
      <textarea name="comment" cols="70" rows="10">{comment}</textarea>
      <label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label>
    
      <label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label>
    
      {if captcha}
        <label for="captcha">Please enter the word you see in the image below:</label>
    
        {captcha}
    
        <input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p>
      {/if}
      <input type="submit" name="submit" value="Submit" />
    {/exp:comment:form}
  • #2 / May 29, 2012 10:38am

    Shane Eckert

    7174 posts

    Hello timkelty,

    I am sorry to hear you are running into this problem.

    I am curious about one detail. Removing index.php with the .htaccess file and then removing the index.php from the Admin->General Configuration is what breaks commenting. But if you set it back to include the index.php in the Control Panel things work. You mentioned emptying your .htaccess file, I take that to mean after you add the index.php file back to the Control Panel right?

    Would you mind showing the contents of your .htaccess file? Curious about that, since things break when you remove the index file.

    Also curious to know if you have customize the config.php to override any values?

    Thanks in advance!

    Cheers,

  • #3 / May 30, 2012 3:01pm

    timkelty

    177 posts

    Figured it out.

    We had the following rule in our htaccess:

    # ----------------------------------------------------------------------
    # Add a trailing slash to all non-file requests
    # ----------------------------------------------------------------------
    <IfModule mod_rewrite.c>
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
      RewriteRule ^(.*)$ $1/ [R=301,L]
    </IfModule>

    The comment module posts to the the same page, the url it creates is without the trailing slash, therefore it was redirecting and losing the POST data.

    The whole trailing slash thing seems very confusing and inconsistent in EE2.

    * docs say generated urls do NOT have trailing slashes (http://ellislab.com/expressionengine/user-guide/modules/wiki/wiki_update_notes.html#trailing-slashes-removed-from-urls)
    * the create_page_url function defaults to adding it
    * {page_url} adds it (via create_page_url)
    * {path=} vars do NOT add it
    * this case, comment forms post to the url without the slash

    What gives? Seems like this should enforced one way or the other. And ideally have a config option to add the trailing slash everywhere if you prefer.

  • #4 / May 30, 2012 3:03pm

    timkelty

    177 posts

    I see that 2.5.1 seems to have addressed the page_url issue:

    Fixed bugs (#17026, #17378) where the Pages module and page_url tags still displayed trailing slashes in some cases.

  • #5 / May 30, 2012 3:33pm

    timkelty

    177 posts

    For the time being, I’ve fixed this issue by adding a condition to our rewrite rule, bailing out if it is a POST:

    <IfModule mod_rewrite.c>
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_METHOD} !^POST$
      RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
      RewriteRule ^(.*)$ $1/ [R=301,L]
    </IfModule>
  • #6 / May 30, 2012 5:50pm

    Shane Eckert

    7174 posts

    Hey timkelty,

    Glad to hear it!

    The slashes, it really depends on what you have set as the base url in the Control Panel or the config.php file.

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases