Welcome Guest, Not a member yet? Register   Sign In
URL issues going from a Local to Server environment
#1

[eluser]Timothy_[/eluser]
Hello,

I have been developing an application using Codeigniter 1.7.1 using LAMPP on my ubuntu machine.

I have been using a .htaccess file (see below) to remove index.php from the URL.

Moving the application to a server environment however is causing quite a few headaches.

Codeigniter 404's whenever i visit a controller without the index.php (for e.g. http://www.subdomain.domain.com/codeigniter/controller)

Things start working when i place the index.php in (for e.g. http://subdomain.domain.com/codeigniter/...controller)

However this is not good because I don't want index.php to be seen.

I have tried each of the available URI protocols

Code:
$config['uri_protocol']    = "AUTO";
None of them change anything.

My .htaccess looks like this:

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    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>

My Code igniter logs look like this:

Code:
DEBUG - 2009-10-05 17:56:09 --&gt; Config Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Hooks Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; URI Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; No URI present. Default controller set.
DEBUG - 2009-10-05 17:56:09 --&gt; Router Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Output Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Input Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Global POST and COOKIE data sanitized
DEBUG - 2009-10-05 17:56:09 --&gt; Language Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Loader Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Config file loaded: config/redux_auth.php
DEBUG - 2009-10-05 17:56:09 --&gt; Config file loaded: config/email.php
DEBUG - 2009-10-05 17:56:09 --&gt; Helper loaded: url_helper
DEBUG - 2009-10-05 17:56:09 --&gt; Helper loaded: form_helper
DEBUG - 2009-10-05 17:56:09 --&gt; Helper loaded: html_helper
DEBUG - 2009-10-05 17:56:09 --&gt; Database Driver Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Session Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Helper loaded: string_helper
DEBUG - 2009-10-05 17:56:09 --&gt; Session routines successfully run
DEBUG - 2009-10-05 17:56:09 --&gt; Email Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Form Validation Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Model Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Controller Class Initialized
DEBUG - 2009-10-05 17:56:09 --&gt; Helper loaded: date_helper

I assume its a .htaccess issue.

If someone has any suggestions I would really appreciate some help.

Thanks

Tim
#2

[eluser]n0xie[/eluser]
Are you sure that mod_rewrite is loaded on the production server?

Also the question mark after your index.php shouldn't be necessary. Try to remove it and see if that helps.
#3

[eluser]Timothy_[/eluser]
Hello nOxie,

Thanks for the reply Smile

mod_rewrite is definetely loaded. I am using it on other live sites.

I tried http://subdomain.domain.com/codeigniter/...controller and that does work.

So where does this leave me now? Could the subdomain be causing problems?

How am I able to get rid of the index.php ?

Thanks again,

Tim
#4

[eluser]n0xie[/eluser]
Is your basepath correctly defined?

Else play around with the .htaccess. Remove the question mark as I said. Then change the uri_protocol around (PATH_INFO is preferred). It's a bit hit or miss with .htaccess depending on how apache is setup...
#5

[eluser]Timothy_[/eluser]
Hello n0xie,

Yes basepath is fine and i tried changing the uri_protocols but none worked.

I have solved this problem by giving it its own subdomain.

Before i had

http://subdomain.domain.com/codeigniterroot/controller

Now i have

http://subdomain.domain.com/controller

and it works great.

Appreciate all your help Smile

Tim




Theme © iAndrew 2016 - Forum software by © MyBB