Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

php - .htaccess and codeigniter not working

I am using snow leopard and I have my local environment and I am trying to get rid of the index.php in the url...here is what i have

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index.php|images|css|js|robots.txt|favicon.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

My config file has this

$config['index_page'] = "";

But when i visit the page without index.php it doesnt work

this works

http://localhost/ci_example/index.php/site

this doesnt

http://localhost/ci_example/site

I tried to follow this

maybe i need to do something with my local conf file...but i really dont know what and i have no idea how to restart apache command line...any ideas

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What do you mean when you say "it doesn't work"? Do you get an error? A white screen? A 500 error?

Did you make sure your httpd.conf file has the AllowOverride setting set to All? If not, it may not be using your .htaccess file, meaning the rewrite rules won't be used.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...