I just added Code Igniter to my XAMPP directory. When I open up this URL, I can see the Welcome screen:
http://localhost:1372/codeigniter/index.php/welcome
Now I want to remove the index.php
part of this URL.
So on config.php
in application/config
, I did set the
$config['base_url']
to 'http://localhost:1372/codeigniter/';
and
$config['index_page']
to '';
.
Then I created an .htaccess
page on the root directory and added these codes to it:
RewriteEngine on
RewriteCond $1 !^(index/.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
So what now should happen is to see the default Welcome page on http://localhost:1372/codeigniter/
URL. But instead of that I get the Internal Server Error somehow!
So what is my mistake. What should I do now?
删除所有htaccess的代码并保存,然后刷新页面,看看会发生什么。
You need to enable mod_rewrite extension. open the file:
C:\xampp\apache\conf\httpd.conf
find the line:
#LoadModule rewrite_module modules/mod_rewrite.so
and uncoment it (remove the # symbol). thus this line must be look like this:
LoadModule rewrite_module modules/mod_rewrite.so
then search all lines with:
AllowOverride None
and change them to
AllowOverride All
then save the file and restart XAMPP
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.