轻翼逐月 发表于 2012-8-7 15:36:46

apache重写问题

本帖最后由 轻翼逐月 于 2012-8-7 16:07 编辑

ci中建立了一个app,为news,指定域名为 news.new_ci.com ,   要在这个目录下实行重写,在news/.htaccess中
RewriteCond %{HTTP_HOST} ^news\.new_ci\.com
#RewriteRule read-(\d+)\.html http://news.new_ci.com/index.php/read/index/$1
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 static/image/common/back.gif
RewriteRule ^index.php/read-(\d+).html$index.php/read/index/$1.html


RewriteCond %{HTTP_HOST} ^news\.new_ci\.com
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1
RewriteRule ^index.php/read-(\d+).html$index.php/read/index/$1

整体这个样子,不行。还是访问不到

轻翼逐月 发表于 2012-8-8 13:39:43

:Q顶上去哈

轻翼逐月 发表于 2012-8-9 12:54:35

{:soso_e122:} 哎,没人....

轻翼逐月 发表于 2012-8-20 17:11:29

{:soso_e147:}没人这样用过么
页: [1]
查看完整版本: apache重写问题