用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3195|回复: 5
收起左侧

[HELP] apache重写问题

[复制链接]
发表于 2012-8-7 15:36:46 | 显示全部楼层 |阅读模式
本帖最后由 轻翼逐月 于 2012-8-7 16:07 编辑

ci中建立了一个app,为news,指定域名为 news.new_ci.com ,   要在这个目录下实行重写,在news/.htaccess中

  1. RewriteCond %{HTTP_HOST} ^news\.new_ci\.com [NC]
  2. #RewriteRule read-(\d+)\.html [url=http://news.new_ci.com/index.php/read/index/]http://news.new_ci.com/index.php/read/index/[/url]$1
  3. RewriteRule read-(\d+)\.html index.php/read/index/$1

复制代码

注释的那行可以访问,但是会301,下面那种写法不行,要实现输入 news.new_ci.com/read-1573.html 实际访问的为news.new_ci.com/index.php/read/index/1573应该怎么写规则?
发表于 2012-8-7 15:45:06 | 显示全部楼层
RewriteRule ^index.php/read-(\d+).html$  index.php/read/index/$1.html
 楼主| 发表于 2012-8-7 15:49:02 | 显示全部楼层
大道达人 发表于 2012-8-7 15:45
RewriteRule ^index.php/read-(\d+).html$  index.php/read/index/$1.html

  1. RewriteCond %{HTTP_HOST} ^news\.new_ci\.com  [NC]
  2. RewriteCond $1 !^(index\.php)
  3. RewriteRule ^(.*)$ /index.php/$1
  4. RewriteRule ^index.php/read-(\d+).html$  index.php/read/index/$1
复制代码

整体这个样子,不行。还是访问不到
 楼主| 发表于 2012-8-8 13:39:43 | 显示全部楼层
  顶上去哈
 楼主| 发表于 2012-8-9 12:54:35 | 显示全部楼层
{:soso_e122:} 哎,没人....
 楼主| 发表于 2012-8-20 17:11:29 | 显示全部楼层
{:soso_e147:}没人这样用过么

本版积分规则