如何使用窗口rdp从codeigniter url中删除index.php(尝试了许多解决方案) [英] how to remove index.php from codeigniter url using window rdp (tried many solutions)
问题描述
我知道这个问题已经被问过很多次了,但是尝试了所有解决方案,但都没有成功
I know this question has been asked many times but have tried all the solutions but invain
我的配置文件如下
$config['base_url'] = 'http://immodernafrican.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
.htaccess文件为
.htaccess file is
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|static|robots\.txt|favicon\.ico|uploads|googlexxxxxxxx\.html|mobile.html)
RewriteRule ^(.*)$ index.php/$1 [L]
已更改
AllowOverride None
收件人
AllowOverride All
但我的网址仍可与index.php一起使用
but still my url works with index.php
immodernafrican.com/index.php/AncientHistory
除此之外,它会显示404错误
other than that it gives 404 error
immodernafrican.com/AncientHistory
推荐答案
关注
对于服务器
-
激活mode_rewrite模块
Activate mode_rewrite module
sudo a2enmod rewrite
重新启动apache
Restart the apache
sudo service apache2 restart
编辑000-default.conf
edit 000-default.conf
sudo nano /etc/apache2/sites-available/000-default.conf
搜索"DocumentRoot/var/www/html",然后在下面直接添加以下行:
Search for "DocumentRoot /var/www/html" and add the following lines directly below:
<Directory "/var/www/html">
AllowOverride All
</Directory>
通过CTRL-X,"y"和ENTER保存并退出Nano编辑器.
Save and exit the nano editor via CTRL-X, "y" and ENTER.
重新启动服务器:
sudo service apache2 restart
在config.php中
in config.php
$config['base_url'] = 'http://immodernafrican.com';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
在routes.php中
in routes.php
$route['default_controller'] = "YOUR_DEFAULT_CONTROLLER";
htaccess文件
htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
这篇关于如何使用窗口rdp从codeigniter url中删除index.php(尝试了许多解决方案)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!