a6266318 发表于 2018-11-24 08:09:44

apache rewrite重写实现ur和目录的l跳转

  有这样一个需求:

  http://www.aa.com   aa.htm
  http://www.aa.com/sax      aa_sax.htm
  他们位于同一个目录ROOT下

  css DD_belatedPNG.jseasydialog.min.jsimagesimagesPlayer.jsrsa.jsvalidate.jsaa.htmaa_sax.htm
  但是他们同时调用cssimages
  所以我在apache 这样配置的(只摘抄重要部分)
  Rewriterule ^/sax/?$ /aa_sax.htm
  Rewriterule ^/sax/css$ /css/
  Rewriterule ^/sax/images$ /images/
  DocumentRoot /space/wwwroot/ROOT
  DirectoryIndex aa.htm aa_sax.htm
  ==================================================
  补充:
  如果访问http://www.aa.com/sax/   还会找不到 css已经image
  针对这种情况 apache配置就需要变换下 如下所示:
  Rewriteengine on
Rewriterule ^/sax/?$ /aa_sax.htm
Rewriterule ^/sax/css/(.*) /css/$1
Rewriterule ^/sax/images/(.*) /images/$1



页: [1]
查看完整版本: apache rewrite重写实现ur和目录的l跳转