Welcome Guest, Not a member yet? Register   Sign In
Remove index.php file
#1

[eluser]Arun Joshi[/eluser]
Hi, I have some problem regarding my root folder installation. Its working now, but I want to change it.

Now I have

Code:
http://localhost/CodeIgniter/index.php/welcome

I need change it into
Code:
http://localhost/CodeIgniter/welcome


Presently I have no .htaccess file in my root, How can I change it, If a .htaccess file is required what should be its content?
#2

[eluser]Jagar[/eluser]
You may need to look at this page: http://ellislab.com/codeigniter/user-gui.../urls.html
#3

[eluser]n0xie[/eluser]
Or try here:
http://codeigniter.com/wiki/mod_rewrite/
#4

[eluser]Arun Joshi[/eluser]
I am using wamp server with Apache/2.2.4 (Win32) PHP/5.2.4 configuration.

now my CI sample site working from
Code:
http://localhost/CodeIgniter/index.php/decode
.
I need change it into
Code:
http://localhost/CodeIgniter/decode

I followed instructions from
Code:
http://codeigniter.com/wiki/mod_rewrite/
. But it does not work.

Now when I access page 'http://localhost/CodeIgniter/decode', it will display my wamp server default localhost home page. But browser url shows 'http://localhost/CodeIgniter/decode'.

When I copy these directory info into my .htaccess,

Code:
<Directory "/some/absolute/path/htdocs">
...
Options FollowSymLinks
AllowOverride FileInfo
...  
</Directory>

I am getting '500 internal server error'. Then I tried the following code in .htaccess file.
Code:
<Directory "/some/absolute/path/htdocs">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>

But it still showing '500 internal server error' error.
Actually what should be the <Directory "/some/absolute/path/htdocs"> path for me?
Does my .htaccess file in its right place?




I have created the .htaccess file in my codeigniter folder.(outside system folder). Does my .htaccess file location is correct?
my physical path is
Code:
E:\wamp\www\CodeIgniter
.

Thanks,
#5

[eluser]Evil Wizard[/eluser]
the sample .htaccess you want to start off with is
Code:
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
This turns on the rewrite (provided it is activated on the server), sets the rewrite base path, checks that the requested URL is not a real file or a directory and sends it transparently through the index.php
#6

[eluser]Arun Joshi[/eluser]
Hi Evil,
Thanks for your response. But the above lines are already in my .htaccess file.

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>
<Directory "/some/absolute/path/htdocs">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>

What should be the '
<Directory "/some/absolute/path/htdocs">' value for me?
#7

[eluser]Daniel Moore[/eluser]
Arun,

The "<Directory " portion of that should be going into the httpd.conf file for apache, not in an .htaccess file. The .htaccess file is already per directory, so you just need to add the options and allow lines.

I think you'll find the heavily documented .htaccess file the following link helpful:
http://www.danielwmoore.com/remove_index...odeigniter

Also, read on what to do to your config.php file as well, also on that page.

That link should get you up and running.




Theme © iAndrew 2016 - Forum software by © MyBB