我只是住在我的网站上。网站链接是:http : //cmexpertiseinfoinfo.in/pos1/,它在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/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>
所以在htaccess中,我正在检查重写模式是否启用?但它不起作用,它显示404页。我把我的.htaccess放在主目录中是这样的,
目录结构,
-application
-.htaccess // this .htaccess has no content (Deny from all )
-system
-user_guide
-public
-.htaccess // this .htaccess's content is show above.
base_url()是:
$config['base_url'] = 'http://cmexpertiseinfotech.in/pos/';
编辑:我只是要求重写模式启用到我的头,但它需要1-2天,所以我正在尝试另一件事,我只是从根目录下的项目中删除了.htaccess文件。
这正在工作。请访问此链接:http : //cmexpertiseinfoinfo.in/pos/index.php/welcome/index。
但这是行不通的。http://cmexpertiseinfoinfo.in/pos/index.php/home/login。
控制器 :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function login()
{
$this->load->view('login');
}
}
查看:Login.php
<h1> Login </h1>
您在这里混淆了两个问题:
此行检查是否已安装和加载:<IfModule mod_rewrite.c>
。
只有加载了Apache之后,Apache才会使用:将其打开RewriteEngine On
。
由于似乎未在此处安装或启用它,因此您需要解决该问题。但是您(或某人)将需要服务器的root权限,然后需要找到Apache配置文件。
这是由提供商托管吗
您需要要求他们启用mod_rewrite
如果可以访问该文件
除非非常严格地安装了Apache,否则您应该能够找到以下行:
#LoadModule rewrite_module modules/mod_rewrite.so
通过删除启用它#
。然后重新启动Apache。
这里很难进入特定的命令,因为Apache的安装方式差异很大。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句