【问题标题】:I cant access my url from codeigniter using wamp server我无法使用 wamp 服务器从 codeigniter 访问我的网址
【发布时间】:2016-03-12 09:43:26
【问题描述】:

我正在使用 codeigniter 并学习 CMS 教程。我已经在我的根目录中添加了 .htaccess。

这是我的 .htaccess 文件:

<IfModule mod_rewrite.cs> 
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
</IfModule>\

我还在位于 httpd.conf 的 wamp 中启用了我的 .htaccess 并进行了更改

#LoadModule rewrite_module modules/mod_rewrite.so

LoadModule rewrite_module modules/mod_rewrite.so

这是我在 Apache wamp 中的错误登录:

[Sat Mar 12 17:26:36 2016] [notice] Apache/2.2.17 (Win32) PHP/5.3.5 configured -- resuming normal operations
[Sat Mar 12 17:26:36 2016] [notice] Server built: Oct 18 2010 01:58:12
[Sat Mar 12 17:26:36 2016] [notice] Parent: Created child process 372
[Sat Mar 12 17:26:36 2016] [notice] Child 372: Child process is running
[Sat Mar 12 17:26:36 2016] [notice] Child 372: Acquired the start mutex.
[Sat Mar 12 17:26:36 2016] [notice] Child 372: Starting 64 worker threads.
[Sat Mar 12 17:26:36 2016] [notice] Child 372: Starting thread to listen on port 80.
[Sat Mar 12 17:26:41 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:43 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:43 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:43 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:44 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:44 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:44 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:44 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:44 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:45 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:45 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:45 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:45 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:46 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:46 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:46 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:46 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:46 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:47 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:47 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:47 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:47 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:47 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:48 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:48 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:48 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/admin
[Sat Mar 12 17:26:52 2016] [alert] [client 127.0.0.1] C:/wamp/www/cms/application/.htaccess: Expected </IfModule> but saw </IfModule>>
[Sat Mar 12 17:26:52 2016] [error] [client 127.0.0.1] client denied by server configuration: C:/wamp/www/cms/system/
[Sat Mar 12 17:26:52 2016] [error] [client 127.0.0.1] client denied by server configuration: C:/Dev, referer: http://localhost/cms/
[Sat Mar 12 17:26:52 2016] [error] [client 127.0.0.1] client denied by server configuration: C:/Dev, referer: http://localhost/cms/
[Sat Mar 12 17:26:52 2016] [error] [client 127.0.0.1] client denied by server configuration: C:/Dev, referer: http://localhost/cms/
[Sat Mar 12 17:27:03 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/public/admin
[Sat Mar 12 17:28:01 2016] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sat Mar 12 17:28:01 2016] [notice] Child 372: Exit event signaled. Child process is ending.
[Sat Mar 12 17:28:02 2016] [notice] Child 372: Released the start mutex
[Sat Mar 12 17:28:03 2016] [notice] Child 372: All worker threads have exited.
[Sat Mar 12 17:28:03 2016] [notice] Child 372: Child process is exiting
[Sat Mar 12 17:28:03 2016] [notice] Parent: Child process exited successfully.
[Sat Mar 12 17:28:04 2016] [notice] Apache/2.2.17 (Win32) PHP/5.3.5 configured -- resuming normal operations
[Sat Mar 12 17:28:04 2016] [notice] Server built: Oct 18 2010 01:58:12
[Sat Mar 12 17:28:04 2016] [notice] Parent: Created child process 3996
[Sat Mar 12 17:28:04 2016] [notice] Child 3996: Child process is running
[Sat Mar 12 17:28:04 2016] [notice] Child 3996: Acquired the start mutex.
[Sat Mar 12 17:28:04 2016] [notice] Child 3996: Starting 64 worker threads.
[Sat Mar 12 17:28:04 2016] [notice] Child 3996: Starting thread to listen on port 80.
[Sat Mar 12 17:29:33 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/public/admin
[Sat Mar 12 17:30:04 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/cms/public/admin
[Sat Mar 12 17:32:21 2016] [warn] pid file C:/wamp/bin/apache/Apache2.2.17/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Mar 12 17:32:22 2016] [notice] Apache/2.2.17 (Win32) PHP/5.3.5 configured -- resuming normal operations
[Sat Mar 12 17:32:22 2016] [notice] Server built: Oct 18 2010 01:58:12
[Sat Mar 12 17:32:22 2016] [notice] Parent: Created child process 3360
[Sat Mar 12 17:32:22 2016] [notice] Child 3360: Child process is running
[Sat Mar 12 17:32:22 2016] [notice] Child 3360: Acquired the start mutex.
[Sat Mar 12 17:32:22 2016] [notice] Child 3360: Starting 64 worker threads.
[Sat Mar 12 17:32:22 2016] [notice] Child 3360: Starting thread to listen on port 80.
[Sat Mar 12 17:32:30 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico, referer: http://localhost/cms/public/index.php/welcome/
[Sat Mar 12 17:32:54 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/public
[Sat Mar 12 17:33:51 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/public
[Sat Mar 12 17:40:24 2016] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/public

【问题讨论】:

  • 删除 .htaccess 文件。
  • 在此服务器上找不到请求的 URL /cms/public/admin/migration。
  • 在此服务器上找不到请求的 URL /cms/admin/migration。
  • 似乎 apache 服务器在 &lt;\IfModule&gt; 之后不喜欢足够的字符。从 17:26:52 开始阅读行。尝试先解决这个问题。

标签: php apache .htaccess codeigniter


【解决方案1】:

在 application/config.php 文件中进行以下更改

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

使用以下代码在根目录中创建 .htacces 文件

RewriteEngine on
RewriteCond $1 !^index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

我。 首先,使用以下命令启动它: a2enmod 重写

二。 编辑文件 /etc/apache2/sites-enabled/000-default 将 All AllowOverride None 更改为 AllowOverride All。

三。 使用以下命令重新启动服务器: sudo /etc/init.d/apache2 重启

【讨论】:

  • 当我再次访问时。它说目录访问被禁止。
  • @JvJay 见上文我做了更改
  • 您好先生,请问如何在 Windows 中实现它:P
猜你喜欢
  • 2013-10-04
  • 1970-01-01
  • 1970-01-01
  • 2014-03-01
  • 2014-09-25
  • 2012-01-03
  • 1970-01-01
  • 2014-06-22
  • 1970-01-01
相关资源
最近更新 更多