我使用CodeIgniter,并试图重写URL友好的SEO。 的目的是......mod_rewrite后不工作[R:重定向]出
http://localhost/FOR-SEO/item/view/id
-> to -> http://localhost/item/view/id
(只是想离开,SEO出)
我尝试添加的htaccess如下,
RewriteRule ^(.*)/item/view/(.*)$ /item/view/$2 [R,L]
所以它成为...
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteRule ^(.*)/item/view/(.*)$ /item/view/$2 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
它工作正常,但在我拿[R]它显示404错误未找到。
我试图检查重写日志,但一切是一样的对于用[R],没有[R]
这里的日志,[R](工作)
[rid#1009868a0/initial] (1) [perdir /Applications/MAMP/htdocs/himaparn/] escaping http://localhost:8888/item/view/2 for redirect
[rid#1009868a0/initial] (1) [perdir /Applications/MAMP/htdocs/himaparn/] redirect to http://localhost:8888/item/view/2 [REDIRECT/302]
[rid#10098a8a0/initial] (1) [perdir /Applications/MAMP/htdocs/himaparn/] internal redirect with /index.php/item/view/2 [INTERNAL REDIRECT]
[rid#100984da8/initial/redir#1] (1) [perdir /Applications/MAMP/htdocs/himaparn/] pass through /Applications/MAMP/htdocs/himaparn/index.php
[rid#1009978a0/subreq] (1) [perdir /Applications/MAMP/htdocs/himaparn/] internal redirect with /index.php/item/view/2 [INTERNAL REDIRECT]
这里是没有[R]的日志,(不工作)
[localhost/sid#100813108][rid#10098f8a0/initial] (1) [perdir /Applications/MAMP/htdocs/himaparn/] internal redirect with /item/view/2 [INTERNAL REDIRECT]
[localhost/sid#100813108][rid#100993a50/initial/redir#1] (1) [perdir /Applications/MAMP/htdocs/himaparn/] internal redirect with /index.php/item/view/2 [INTERNAL REDIRECT]
[localhost/sid#100813108][rid#100991828/initial/redir#2] (1) [perdir /Applications/MAMP/htdocs/himaparn/] pass through /Applications/MAMP/htdocs/himaparn/index.php
[localhost/sid#100813108][rid#1009978a0/subreq] (1) [perdir /Applications/MAMP/htdocs/himaparn/] internal redirect with /index.php/item/view/2 [INTERNAL REDIRECT]
这是什么错误,我有什么不对的做法,使我的工作?
非常感谢!
那么你有什么想法做出同样的结果吗? – chaintng 2013-03-26 00:47:36
如果它与'[R]'一起使用,为什么不离开它?问题是什么?期望的结果是什么? – stormdrain 2013-03-26 13:17:04
我想制作一个seo友好的网址。把[R]更改URL的结果。但我想让搜索引擎看到我的面具网址。 – chaintng 2013-03-26 14:43:56