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

July 04, 2012 3:02pm

Subscribe [3]
  • #1 / Jul 04, 2012 3:02pm

    amimpact

    11 posts

    When deploy an Expression engine website I had some problems with the htaccess. On http://expressionengine.com/docs_assets/general/remove_index.php.html there is an example that says the following:

      # If 404s, “No Input File” or every URL returns the same thing
      # make it /index.php?/$1 above (add the question mark)

    What difference does the question mark make in this case?

    I tested this on 2 different hosting platforms. One of the hosting platforms showed an error like “no input file”.

    After adding the questionmark the site only worked when index.php was in the url. For every other url that was called, the homepage was shown.

    How could this happen?

  • #2 / Jul 04, 2012 3:58pm

    MadWebDesigns

    147 posts

    Hi amimpact,

    Please post the entire contents of your htaccess file so we can have a look.

    Thank you,

    Mike

  • #3 / Jul 05, 2012 1:53am

    amimpact

    11 posts

    Here is de content of the .htaccess


    <IfModule mod_rewrite.c>
      RewriteEngine On

    # always redirect to main domain with 301
      RewriteCond %{HTTP_HOST} !^www.domainname.com$
      RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,QSA,L]

      # 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>

  • #4 / Jul 05, 2012 10:21am

    MadWebDesigns

    147 posts

    I think this should fix it for you:

    # always redirect to main domain with 301
    RewriteCond %{HTTP_HOST} !^www\.domainname\.com$
    RewriteRule ^(.*)$ <a href="http://www.domainname.com/$1">http://www.domainname.com/$1</a> [R=301,QSA,L]
    
    # Removes index.php
    RewriteCond $1 !\.(css|js|swf|gif|jpe?g|png|ico)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?$1 [L]

    Cheers,

    Mike

  • #5 / Jul 05, 2012 11:27am

    Shane Eckert

    7174 posts

    Hey amimpact,

    I am glad that Mike has been able to help you out here.

    If his example does not work for you, you may want to head over to Community Help Forum. The only version of the .htaccess file that we support is the following.

    <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>

    Please let me know if there is anything else I can do.

    Cheers,

  • #6 / Jul 19, 2012 5:08am

    amimpact

    11 posts

    Thanks for the examples.
    I want to know what de questionmark does in this exact situation.
    Why won’t it work if the questionmark is not used?


    How can it be that only the homepage will be shown?

  • #7 / Jul 19, 2012 4:10pm

    Shane Eckert

    7174 posts

    Hey amimpact,

    These are good questions!

    This here should explain why the questions mark is needed. Each server is different and some require query strings.

    The homepage shows because it’s the homepage. There is not other segments in the URL which would require or not require query strings. Does that make sense?

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases