php - CodeIgniter htaccess and URL rewrite issues -
i have never used codeigniter before, allow lone php framework , thought give try. going fine except cannot seem remove index.php url , still access pages.
i have never used mvc construction learning go, forgive me if i'm doing wrong.
i trying access view created called 'about_page.php' typing in localhost/ci/about can access using localhost/ci/index.php/about
the controller page is: /application/controllers/about.php model page is: /application/models/about_model.php , view page is: /application/views/about_page.php
i have searched solution issue, haven't been able find one. here have searched:
codeigniter - removing index.php codeigniter - how remove index.php url? http://www.farinspace.com/codeigniter-htaccess-file/
codeigniter comes .htaccess file in 'application' folder contains allow deny all
. created new .htaccess file in root directory, http://localhost/ci/.htaccess
, added code it:
rewriteengine on rewritebase /ci rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l]
when .htaccess file in root directory 500 internal server error. when re-create exact same file applications folder 500 error goes away, still cannot access page using localhost/ci/about
i have changed $config['index_page'] = 'index.php';
$config['index_page'] = '';
, tried changing $config['uri_protocol'] = 'auto';
$config['uri_protocol'] = 'request_uri';
still getting internal server error.
i went httpd.conf file , uncommented mod_rewrite.so module know mod_rewrite active.
does have ideas why isn't working or how can work? know there alot of questions on stackoverflow on subject couldn't find 1 answered question.
am doing right? should able access page visiting localhost/ci/about or have create 'about' directory in 'application' directory?
there 3 steps remove index.php
1.make below changes in application/config.php file
$config['base_url'] = 'http://'.$_server['server_name'].'/your ci folder_name'; $config['index_page'] = ''; $config['uri_protocol'] = 'auto';
2.make .htacces file in root directory using below code
rewriteengine on rewritecond $1 !^(index\.php|resources|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa]
3.enable rewrite mode (if rewrite mode not enabled)
i. first, initiate next command:
a2enmod rewrite
ii. edit file /etc/apache2/sites-enabled/000-default
change allowoverride none allowoverride all.
iii. restart server next command:
sudo /etc/init.d/apache2 restart
php .htaccess codeigniter
No comments:
Post a Comment