Welcome Guest, Not a member yet? Register   Sign In
Remove index.php (desperately need help)
#1

[eluser]PlayMate[/eluser]
I'm sorry for bothering with this topic again. I'm desperately removing index.php from my Ci application. My htacess works on my localhost, but it isn't in my hosting site (error 500). I have tried all of htaccess mentioned in this forum and wiki. My current htaccess :
Code:
# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /test/

# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$0 [PT,L]

My ci installation dir on hosting:
Code:
/www
--test
---index.php
---.htaccess
---system
---etc

You can check my site Here. The correct page display phpinfo() like this one.

Thank you in advance. Sorry for my bad English.
Regard
#2

[eluser]Udi[/eluser]
Check Apache logs... see where its trying to access.

This is my .htaccess file, and I don't define RewriteBase.. :
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|uploads|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
#3

[eluser]PlayMate[/eluser]
Udi, thank you so much your .htaccess it works! But my css and js file not loaded.
I try to modify my old htaccess (which the css and js works) like this:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
it still get the error 500.

Oh yeah, where can i see the apache log if i experience this problem in future? SOrry if sound stupid questions.
#4

[eluser]Udi[/eluser]
take a look at this line in my htaccess:
Code:
RewriteCond $1 !^(index\.php|uploads|favicon\.ico|robots\.txt)
next to uploads you can add your css/js folders, or if their files you can add them like favicon\.ico..
#5

[eluser]PlayMate[/eluser]
I get it. Thank you so much. Solved..
#6

[eluser]Adrian Walls[/eluser]
I too am having issues with this. I have a directory in the webroot called assets under which are sub folders such as css, js, images etc...

If I add the assets folders as below (after uploads):

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

it will display the site images OK but the stylesheet is not being loaded. Do I need to add the css sub directory to this i.e. assets/css and if so what is the correct syntax for doing this?
#7

[eluser]Udi[/eluser]
That's strange, try accessing the assets folder by URL... what you get?
try accessing assets/css and assets/js - what you're seeting?
#8

[eluser]Adrian Walls[/eluser]
Yeah that works fine. I can view a directory listing if I try to access it directly with the url.

For the rewrite rule is it sufficient to just add the assets folder to the rule as in the example in my last post or do I need to specify all the sub dir's under assets as well?
#9

[eluser]Udi[/eluser]
No.. you don't.
I use the same method, only its called 'res' [for resource] and not 'assets'.

The assets folder is in the same level as system folder or index.php file?
#10

[eluser]Adrian Walls[/eluser]
My directory structure under web root is:

Code:
-.htaccess
-index.php
-system
-assets
  -css
    -images
  -js
  -images
  -templates




Theme © iAndrew 2016 - Forum software by © MyBB