Php .htaccess在codeigniter中不工作
我只是住在我的网站上。网站链接为: 它在localhost中运行良好。我的.htaccess文件是Php .htaccess在codeigniter中不工作,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,我只是住在我的网站上。网站链接为: 它在localhost中运行良好。我的.htaccess文件是 <IfModule mod_rewrite.c> RewriteEngine On # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading # slashes. # If your page resides at # http://www.example.com/
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /pos
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.
ErrorDocument 404 /index.php
</IfModule>
基本url()是:
$config['base_url'] = 'http://cmexpertiseinfotech.in/pos/';
编辑:
我只是请求在头脑中启用重写模式,但这需要1-2天,所以我正在尝试另一件事,我刚刚从根目录上的项目中删除了.htaccess文件
这是有效的。请访问此链接:
但这是行不通的。
控制器:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function login()
{
$this->load->view('login');
}
}
您在这里混淆了两个问题:
是否已安装/启用mod_rewrite
重写引擎是否打开/处于活动状态
此行检查是否已安装和加载:
只有在加载后,Apache才会通过以下方式打开它:
重新启动引擎
因为这里似乎没有安装或启用它,所以您需要解决这个问题。但是您(或某人)需要在服务器上具有root权限,然后需要查找Apache配置文件
这是由提供商托管的吗
您需要让他们启用mod_rewrite
如果您可以访问该文件
除非Apache的安装非常严格,否则您应该能够找到以下行:
\LoadModule rewrite\u module modules/mod\u rewrite.so
通过删除#
来启用它。然后重新启动Apache
这里很难进入特定的命令,因为Apache的安装方式有太多的变化。它有点像tin上说的那样。如果未安装mod_rewrite,则要求它显示404。它显示了一个404。为什么我们不能断定没有安装mod_rewrite?谢谢您的回复。我在。htaccess方面很差。兄弟,请指导我在这里做什么?重写引擎打开意味着它是启用的,所以这里的问题是什么?我不明白,哈哈!我理解这种混乱。我会把我的回答写在一个答案里,这样我就可以更好地格式化它!哦。。谢谢你的回复,兄弟。我正在检查是否有root权限。我有主机盖特作为供应商。如何在主机gator中检查root权限???我想这是主机gator支持台的问题。堆栈溢出上没有人与他们有关联。哦,兄弟,我正在向主机gator提出一个关于启用重写模式的问题。我会让你知道的谢谢你的回复。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function login()
{
$this->load->view('login');
}
}
<h1> Login </h1>