Welcome Guest, Not a member yet? Register   Sign In
remove the index.php from URL
#1

[eluser]loca[/eluser]
I want to remove the index.php from my URL,I make follow the CodeIgniter User Guide.
I add the following code in my .htaccess file

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

But It doesn't work. Anybody help me. Thanks!
#2

[eluser]skiter[/eluser]
This rule:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Only works if:
- you are NOT in 'root' domain: www.example.com

Apache have root_document as ... /www/root for example, then server ignore last / in URL (URI).

If you have:
www.example.com/code/

Then server try to get full path to folder, and then he adds / at end!

So you can have 2 rules this from above and:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Where will be: www.example.com/index.php - will work as i mention before apache ignore last / in document root!




Theme © iAndrew 2016 - Forum software by © MyBB