【问题标题】:htaccess - using codeigniter frameworkhtaccess - 使用 codeigniter 框架
【发布时间】:2014-02-02 05:07:10
【问题描述】:

我搜索了很多网站和很多链接,我遵循相同的方法在 wamp 中启用 htacces 但面临问题,现在默认使用 index.php,即使我在没有 index.php 的情况下运行页面,它也无法正常工作,即使 msg 来了在服务器上找不到页面我已经在 apache 模块中启用了 httpd.conf 文件从重写模块中删除了 # 符号,我在 htaccess 文件中使用下面提到的代码作为 codeigniter 的建议我共享 htaccess 代码

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

请提出建议,以便我可以在 wamp 服务器上解决此问题

【问题讨论】:

  • 您在httpd.conf 中进行更改后是否重新启动了WAMP
  • 重启服务也会重启电脑。

标签: php .htaccess codeigniter wamp


【解决方案1】:

在您的 htaccess 中尝试此代码:

RewriteEngine On
RewriteBase /my_project_name/
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

【讨论】:

  • 我已经接受了:p msg 一次又一次地等待 3 分钟,这就是我等待的原因:D
  • 我还有一个问题,请您看一下代码并提出建议
  • 你必须按照规则发布新问题
  • 我知道 :) link 请检查这个问题
【解决方案2】:

试试这个

DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 2017-11-19
    • 1970-01-01
    • 2017-10-30
    • 1970-01-01
    • 2011-05-19
    • 2015-10-24
    相关资源
    最近更新 更多