php - How to set codeigniter for apache server? -
updated, i'm having issues deploying codeigniter project on ubuntu server, 404 apache error when click on links.
when put project in http://roy.my-domain.com/ = /var/www/html/ folder - it's works fine - when added sub directory http://roy.my-domain.com/roy/ = /var/www/html/roy/ - 404 errors .
when url http://roy.my-domain.com/roy/index.php/about - codeigniter 404 error , not apache2.
the error :
not found
the requested url /index.php not found on server.
apache/2.4.18 (ubuntu) server @ roy.my-domain.com port 80
here settings :
0 . checked rewrite mod in apache - got "module rewrite enabled"
1 . my project in /var/www/my-project/
2 . in contains following : application system public_html index.php .htaccess
the .htaccess file :
< ifmodule mod_rewrite.c > rewriteengine on rewritebase /html/my-project/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d
# rewrite other urls index.php/url rewriterule ^(.*)$ index.php?url=$1 [pt,l]
< /ifmodule > < ifmodule !mod_rewrite.c> errordocument 404 index.php < /ifmodule >
the apache2.conf :
< directory /var/www/ > options indexes followsymlinks require granted < /directory >
< directory /var/www/html/ > options indexes followsymlinks allowoverride require granted < /directory >
the config.php :
$config['base_url'] = 'http://roy.my-domain/my-project/'; $config['index_page'] = ''; $config['uri_protocol'] = 'auto';
the index.php :
(don't work ../system , ../application) $system_path = 'system'; $application_folder = 'application';
the controllers :
(codeigniter default view) welcome.php about_controller.php
the views: (codeigniter default view) welcome_message.php about.php
locally - works fine...thanks
<directory /var/www/> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory>
.htaccess:
rewriteengine on rewritebase /html/project/ rewritecond %{the_request} \s/+(.*?)/{2,}([^\s]*) rewriterule ^ %1/%2 [r=302,l,ne] rewritecond %{the_request} ^[a-z]{3,}\s/+(.+?)/{2,}[?\s] [nc] rewriterule ^ /%1/ [l,r=301] rewritecond %{http_host} !^www\. [nc] rewriterule ^ http://www.%{http_host}%{request_uri} [r=301,l] rewritecond %{request_uri} system|application rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l]
try configuration , don't forget reload apache.
Comments
Post a Comment