我正在使用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
答案 0 :(得分: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重写
II。 编辑文件/ etc / apache2 / sites-enabled / 000-default 将All AllowOverride None更改为AllowOverride All。
III。 使用以下命令重新启动服务器: sudo /etc/init.d/apache2 restart