CodeIgniter Forums
CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems (/showthread.php?tid=28975)

Pages: 1 2 3


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]InsiteFX[/eluser]
You can try this one, pay attention to the comments...

I am running XAMPP 1.7.3 with PHP 5.3.1

Also make sure that LoadModule rewrite_module modules/mod_rewrite.so

is turned on in your apache http.conf file...

Also the path is http://localhost/ because your running on a local machine.

The .htaccess file should be placed in the root directory were
CodeIgniter's index.php file is.

Code:
#
# On Windows it is
<IfModule mod_rewrite.so>
#
#<IfModule mod_rewrite.c>
#
Options +FollowSymLinks
DirectoryIndex index.php
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|images|css|js|flv|swf|pdf||robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
#
</IfModule>

# on Windows it is
<IfModule !mod_rewrite.so>
#
#<IfModule !mod_rewrite.c>
#
ErrorDocument 404 /index.php
#
</IfModule>

A lot of people make this mistake!
on Windows the extension is .so not .c

Enjoy
InsiteFX


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]nickstaroba[/eluser]
Yes, I noticed the extension difference and tried that in both your file and the original that I posted. No luck. I'm reading up on the rewrite module now in hopes I can figure this out...it's something I should know anyway.

I thought this was going to be simple but it's taking longer than I expected so I have another question. I'm relatively new to web development so please forgive my ignorance of these things.

Here is my think on this (please correct me if I'm wrong in this somewhere):

I want index.php gone on the production version of this app.

I want my URLs to be accurate in my development version locally for smooth implementation to production.

So, in order for my local version to be accurate (in terms of URLs) I need to mirror the the production version locally, i.e. no index.php. Correct?

Also, while I need to know the way to do this using Apache (for many reasons), the production environment is using IIS so I'm also going to have to figure out how to manipulate the URL there as well.

So, am I just wasting my time or what? Do I really need to have the index.php removed locally if I'm implementing on IIS anyway?

I'm assuming I do, but I'm still new so in case I'm missing something, I have to ask.


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]InsiteFX[/eluser]
Sometimes it will not work on windows.

Have sites live that it works on fine.

Enjoy
InsiteFX


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]InsiteFX[/eluser]
You do not need to have it removed locally, just make sure
that when you go live that you upload the .htaccess file
were index.php is.

Also in your config.php file
$config['index_page'] = "";

You will also need to change your
$config['base_url'] = live site";

And edit your index.php so that it points to the system and application folders.

Enjoy
InsiteFX


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]InsiteFX[/eluser]
Here is a very good site for some of the things you are looking for.

Addedbytes

Enjoy
InsiteFX


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]nickstaroba[/eluser]
Addedbytes looks like a good site. I'm going to start reading through their tutorials.

In the meantime though I tried the very first example found on this site:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite

And it's not working at all...

I'm totally perplexed by this. I know it's reading the file because when I type random characters I get a 500 error. But when I use the example .htaccess:

Code:
RewriteEngine on
RewriteRule ^alice.html$ bob.html

nothing happens...

This is very confusing.


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]nickstaroba[/eluser]
Could this have something to do with read/write permissions??


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 03-31-2010

[eluser]InsiteFX[/eluser]
It could depending on what version of windows your running

I have a user account on Windows Vista with Administrator rights.

Enjoy
InsiteFX


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 04-26-2010

[eluser]nickstaroba[/eluser]
Somehow I got this working. I really don't know what I was doing wrong because I thought I had tried this scenario before. I'll have to review it later today, as I don't have time but I do want to post how this is working now.

Using xampp, I placed the Codeigniter directly into htdocs so that http://localhost/ would take me to the welcome page. I then placed the .htaccess file exactly as described in the documentation into the htdocs folder. So, it is in the same folder as the main index.php for CI.

I also got this working for vhosts in the same manner. Index.php in the root folder with the .htaccess and it works.

Hope this helps. I can give more details later on.


CodeIgniter 1.7.2 + XAMPP 1.7.3 + .htacess problems - El Forum - 06-07-2010

[eluser]Mini0n[/eluser]
Can anyone help me on this?
I've done everything stated on this thread, and got no success...
CodeIgniter 1.7.2 @ Windows 7 with XAMPP 1.7.3.

http://localhost/ci/ - Works
http://localhost/ci/index.php - Works
http://localhost/ci/index.php/demo - Works
http://localhost/ci/demo - The page redirects to http://localhost/xampp

The .htaccess file is located at htdocs/ci/.htaccess and contains:

Code:
<IfModule mod_rewrite.so>
    RewriteEngine On
    RewriteBase /ci/

    #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]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    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.so>
    # 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>

And on the CI's config.php:

Code:
$config['index_page'] = "";

Code:
$config['uri_protocol']    = "AUTO";
This doesn't work even if it's REQUEST_URI



What am I missing?


Thanks.