【问题标题】:codeigniter htaccess rewrites the url to the BASEPATH../codeigniter htaccess 将 url 重写为 BASEPATH../
【发布时间】:2012-11-28 17:21:55
【问题描述】:

我有一个使用 codeigniter 制作的网站,它在本地机器上运行良好,但是当我将它上传到服务器时,它给了我 500 错误,当我删除 htaccess 时,错误消失了,在本地机器错误以不同的方式出现有时我找不到导致这种情况的原因,但有些网址会像这样重写: 原始网址 => http://domain.com/controller/method 重写后的 url => http://domain.com/absolute/path/to/controller/method 这是我的 htaccess 文件:

RewriteEngine On
RewriteRule ^(welcome(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
RewriteRule ^(.+)/$ $1 [L,R=301]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

任何帮助,谢谢。

【问题讨论】:

  • 你的服务器上加载了 mod_rewrite 吗?你的错误日志是怎么说的?

标签: .htaccess codeigniter url url-rewriting url-routing


【解决方案1】:

试试我的.htaccess 代码........

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

【讨论】:

  • 对不起,我只有 12 名声望,直到我达到 15 岁才能投票。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-15
  • 1970-01-01
  • 2019-12-05
  • 1970-01-01
  • 2013-01-24
  • 1970-01-01
  • 2012-02-03
相关资源
最近更新 更多