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.

hosting issue - mod_rewrite and php version

April 27, 2008 3:07pm

Subscribe [1]
  • #1 / Apr 27, 2008 3:07pm

    got 2 doodle

    171 posts

    As I understand it mod_rewrite is a server issue.  My hosting provider Netfirms is telling me that there is something wrong with my .htaccess file because I cannot remove the index.php on their server using php5 only php4.  I works fine on my dev system in php5 it works fine on their system in php4 but it does not work on their system in php5.

    I don’t know enough about this stuff, but I think they are handing me a crock of uh something.

    http://www.netfirms.com/web-hosting/

    According to their advertising they offer mod_rewrite and php4/5 (no restrictions mentioned)

    Any other hosting firms someone could reccomend.

    These guys look interesting http://www.medialayer.com/hosting/index.html anyone use them?

    Thanks,
    Jeff

  • #2 / Apr 27, 2008 4:10pm

    Tom Glover

    493 posts

    The mod_rewrite are to do with Apache and nothing to do with PHP 4 or 5, so it should work with either. I’m sorry but I don’t no much more about the issue than this. But I can recommend a another host where this works perfectly on in PHP 4 & 5 and has been tested with CI; http://www.wackywebs.net. We can provide this hosting from as little as £2.99 a month for 1gb of space and 100gb of transfer.

  • #3 / Apr 27, 2008 4:15pm

    got 2 doodle

    171 posts

    Hi all
    after more research I found the following thread

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

    This is the importan line here

    RewriteRule ^(.*)$ /index.php?/$1 [L] <—do not forget the ? after index.php!

    In php4 the rewrite rule worked without the ?

    In php5 not!

    I really don’t know why ( i really don’t know squat ! )

    Anyway I answered my own question, sort of, no thanks to netfirms.

    Jeff

  • #4 / Apr 27, 2008 4:27pm

    Tom Glover

    493 posts

    Thanks for sharing the incite of knowledge, this will help other people with the same problems. Most people just Put Solved in the tile and don’t explain how they did it, this is no use to other people who have the same problems. Thanks for explain how you found the answer! 😊

  • #5 / Apr 27, 2008 10:13pm

    got 2 doodle

    171 posts

    I’m glad I could add a little substance to this group.  I am looking forward to the day when I have some actual real wisdom and knowledge that I can share.

    I have learned a lot in my lurking.

    Jeff

  • #6 / Apr 28, 2008 4:50am

    Ergose

    20 posts

    Yeah, thanks for posting that. I’ll probably run into that problem later on when I’m about to go live where I work, so I’ll make note.

  • #7 / Apr 29, 2008 8:28am

    jaume

    28 posts

    Hi!

    I’m having the same problem… I had PHP4 and everything worked fine… But mow with this setting:
    Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 Server at localhost Port 80

    This is what I get:

    - clean CI 1.6.1. shows welcome controller, and using http://localhost/ci/index.php/welcome also works OK.

    - When adding ah .htaccess file like this:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]

    and setting index_page to blank:

    $config['base_url']    = "http://localhost/ci/";
    $config['index_page'] = "";

    when typing this:

    <a href="http://localhost/ci/welcome">http://localhost/ci/welcome</a>

    a 404 error page appears:
    The requested URL /ci/welcome was not found on this server.

    Any idea on what Am I doing wrong?

  • #8 / Apr 29, 2008 9:16am

    got 2 doodle

    171 posts

    Hi, you could try what I did and put the ? after the index.php

    RewriteRule ^(.*)$ /index.php?/$1 [L] <—do not forget the ? after index.php!

    I notice you don’t have that in your .htaccess

    Jeff

  • #9 / Apr 30, 2008 5:42am

    jaume

    28 posts

    @got 2 doodle

    I’ve tried it with the question mark after index.php and without the slash before index.php.

  • #10 / Apr 30, 2008 12:58pm

    Tom Glover

    493 posts

    RewriteRule ^(.*)$ ci/index.php?/$1 [L]

    ? maybe?

  • #11 / May 06, 2008 6:48am

    jaume

    28 posts

    RewriteRule ^(.*)$ ci/index.php?/$1 [L]
    ? maybe?

    nope. Not working. :(

  • #12 / May 06, 2008 7:32am

    jaume

    28 posts

    I got it to work… But maybe there is a better way… This is how I did it:

    this is the .htaccess file:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /ci/index.php/$1 [L]

    Without the /ci/ it said /index.php/page could not be found in the server.

    Also tweaked /etc/apache2/sites-available/default:

    DocumentRoot /var/www/
            <Directory >
                    Options FollowSymLinks
                    AllowOverride All 
            </Directory>
            <Directory /var/www>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All 
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    # RedirectMatch ^/$ /apache2-default/
            </Directory>

    Both AllowOverride where set to None by default.

    Is this the best way to proceed?

  • #13 / May 06, 2008 7:34am

    jaume

    28 posts

    Thanks WackyWebs.net! Your post headed me in the right direction! 😉

  • #14 / May 06, 2008 7:40am

    jaume

    28 posts

    The second AllowOverride set to All and the first to None also work properly! 😉

    DocumentRoot /var/www/
            <Directory >
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2 default start page
                    # in /apache2-default/, but still have / go to the right place
                    # RedirectMatch ^/$ /apache2-default/
            </Directory>
  • #15 / May 06, 2008 8:30am

    got 2 doodle

    171 posts

    do you have a rewrite_base specified

    This is what works for me on the remote server, index is located in /my-root-dir/sbx1/tatacentre.ca/index.php

    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /sbx1/tatacentre.ca/
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
       # If we don't have mod_rewrite installed, all 404's
       # can be sent to index.php, and everything works as normal.
       # Submitted by: ElliotHaughin
    
       ErrorDocument 404 /index.php
    </IfModule>

    Remote server is Linux running apache 2.2 and php 5

    This works locally on xamp local files are located at c:/xampp/htdocs/tatacentre.ca/index.php

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /tatacentre.ca/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        # If we don't have mod_rewrite installed, all 404's
        # can be sent to index.php, and everything works as normal.
        # Submitted by: ElliotHaughin
    
        ErrorDocument 404 /index.php
    </IfModule>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases