【发布时间】:2014-10-16 10:53:12
【问题描述】:
我在 Apache 重写时遇到问题,由于某些原因,上面的第一条规则 NOT wokring WITHOUT flag "R"。
但我想在内部进行重定向。
# FROM http://mysite.ru
# TO http://mysite.ru/?_escaped_fragment_=
# SNAPSHOT /mysite/server/base/public/snapshots/index.html
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=$
RewriteRule ^$ /snapshots/index.html? [NC,R,L] # NOK (if R missed)
# FROM http://mysite.ru/object/767
# TO http://mysite.ru/object/767?_escaped_fragment_=
# SNAPSHOT /mysite/server/base/public/snapshots/object/767.html
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$
RewriteRule ^(.*)$ /snapshots%{REQUEST_URI}%1.html? [NC,L] # OK
Apache 日志:
init rewrite engine with requested uri /
pass through /
strip per-dir prefix: /mysite/server/base/public/ ->
applying pattern '^(.*)$' to uri ''
RewriteCond: input='mysite.ru' pattern='^www\\.(.*)$' [NC] => not-matched
strip per-dir prefix: /mysite/server/base/public/ ->
applying pattern '^$' to uri ''
RewriteCond: input='_escaped_fragment_=' pattern='^_escaped_fragment_=$' => matched
rewrite '' -> '/snapshots/index.html?'
split uri=/snapshots/index.html? -> uri=/snapshots/index.html, args=<none>
internal redirect with /snapshots/index.html [INTERNAL REDIRECT]
init rewrite engine with requested uri /index.html
pass through /index.html
strip per-dir prefix: /mysite/server/base/public/index.html -> index.html
为什么内部重定向不起作用?
更新
完整的 htaccess:https://www.dropbox.com/s/alqqjb11wy367sb/htaccess.txt
Apache 主配置:https://www.dropbox.com/s/p23vv0dd5ffrfaj/conf.txt
【问题讨论】:
标签: ajax apache mod-rewrite seo