Welcome Guest, Not a member yet? Register   Sign In
Can't remove index.php in the url in ci2.0?
#1

[eluser]chefnelone[/eluser]
Hello

In ci1.7 I use this code in .htaccess to remove index.php from the url: (but isn't working in ci2.0)

localhost/ci2/.htaccess
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /ci2/
    

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>

    ErrorDocument 404 /index.php
    
</IfModule>

in application/config/config.php I have:

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

What more do I need to do?
#2

[eluser]chefnelone[/eluser]
I also tried this one:
http://ellislab.com/forums/viewthread/172972/#822401
but isn't working neither...
#3

[eluser]Rok Biderman[/eluser]
There is a couple of things that changed since the last release. It's been mentioned here a couple of times in the last week, but this is what has worked for me:

for htaccess

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

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

or

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ ./index.php/$1 [L]
    
</IfModule>

both work for me. Be sure to change
Code:
$config['uri_protocol']="REQUEST_URI";
in config.php, the auto option doesn't work.

Don't forget the $system_path and $application_folder in index.php to your folders.
#4

[eluser]chefnelone[/eluser]
[quote author="Coccodrillo" date="1297223561"]There is a couple of things that changed since the last release. It's been mentioned here a couple of times in the last week, but this is what has worked for me:

for htaccess

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

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

or

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ ./index.php/$1 [L]
    
</IfModule>

both work for me. Be sure to change
Code:
$config['uri_protocol']="REQUEST_URI";
in config.php, the auto option doesn't work.

Don't forget the $system_path and $application_folder in index.php to your folders.[/quote]

Thanks,
I set $config['uri_protocol'] = 'QUERY_STRING'; and now is fine.
#5

[eluser]Fribos[/eluser]
[quote author="Coccodrillo" date="1297223561"]There is a couple of things that changed since the last release. It's been mentioned here a couple of times in the last week, but this is what has worked for me:

for htaccess

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

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

or

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ ./index.php/$1 [L]
    
</IfModule>

both work for me. Be sure to change
Code:
$config['uri_protocol']="REQUEST_URI";
in config.php, the auto option doesn't work.

Don't forget the $system_path and $application_folder in index.php to your folders.[/quote]

Hey, thanks for the info, it helped me but no solved my problem. For some reason i got a 500 Internal Server Error when i was trying to use a not default controller.
I must use http://mysite.com/index.php/noDefaultController instead http://mysite.com/noDefaultController.
#6

[eluser]Fribos[/eluser]
Well, i did it !!!
It looks like .htaccess must be on root folder instead application folder
Tongue
#7

[eluser]k7faq[/eluser]
@llusoft

If you look closely you should find .htaccess files in several directories now in CI2.0.

The / (root) folder contains the one for the mod rewrite commands, etc. All others prevent unauthorized access directly to folders for security.
#8

[eluser]dimasVS[/eluser]
[quote author="Coccodrillo" date="1297223561"]There is a couple of things that changed since the last release. It's been mentioned here a couple of times in the last week, but this is what has worked for me:

for htaccess

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

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

or

Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ ./index.php/$1 [L]
    
</IfModule>

both work for me. Be sure to change
Code:
$config['uri_protocol']="REQUEST_URI";
in config.php, the auto option doesn't work.

Don't forget the $system_path and $application_folder in index.php to your folders.[/quote]

Sorry, but I got error message :

Code:
Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Sun 22 May 2011 04:58:45 PM WIT
Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

I've been set chmod 777 in all directory.
Is there any other way ?

Thanks..
#9

[eluser]InsiteFX[/eluser]
What Operating System are you running?

InsiteFX
#10

[eluser]dimasVS[/eluser]
[quote author="InsiteFX" date="1306076765"]What Operating System are you running?

InsiteFX[/quote]

Ubuntu 11.04




Theme © iAndrew 2016 - Forum software by © MyBB