【问题标题】:rewriting URL using apache rewriterule使用 apache rewriterule 重写 URL
【发布时间】:2017-04-20 10:18:57
【问题描述】:

如何配置规则以重写 URL

https://globalecom1.psic.com/webapp/wcs/stores/servlet

https://dev-accessories.int.com

两个域名都指向同一个 apache 服务器。

【问题讨论】:

  • 你有没有尝试过,来自here
  • RewriteCond %{HTTP_HOST} ^dev\-accessories\.int\.com$ \n RewriteRule ^/$ https://dev-accessories.int.com/webapp/wcs/stores/servlet [R,NE] 可以解决问题,但我想从 URL 中截断 /webapp/wcs/stores/servlet。添加RewriteRule ^/(.*) /webapp/wcs/stores/servlet/$1 [PT,L] 不起作用。
  • @Dusan 我也有其他域指向同一服务器,例如dev-parts.int.com,并希望它们具有相同的效果。 RewriteCond %{HTTP_HOST} ^dev\-parts\.int\.com$RewriteRule ^/$ https://dev-parts.int.com/webapp/wcs/stores/servlet [R,NE]
  • 您想在用户浏览器地址栏中保留初始 URL 还是将其更改为 dev-accessories.int.com ?
  • 改成 dev-accessories.int.com

标签: apache mod-rewrite httpd.conf


【解决方案1】:

应该这样做:

RewriteRule ^/webapp/wcs/stores/servlet/?(.*) https://dev-accessories.int.com/$1 [R,NE]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    • 2014-07-14
    • 2010-11-25
    • 1970-01-01
    • 2013-11-02
    • 1970-01-01
    • 2011-11-10
    相关资源
    最近更新 更多