使用apache vhost配置重定向到新域

编程入门 行业动态 更新时间:2024-10-04 15:30:58
本文介绍了使用apache vhost配置重定向到新域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个如下的apache虚拟主机配置.我希望所有来自

I have an apache vhost configurations as below. I want all my requests from

somedomain/loadproduct?product=dell-inspiron-15

要重定向到

someotherdomain/dell-inspiron-15 .

我可以从vhost配置中执行此操作吗?请注意,我在网址中有查询参数.

Can I do this from vhost configuration? Note that I have query parameters in the url.

Listen 12567 NameVirtualHost *:12567 <VirtualHost *:12567> ServerName somedomain ProxyPreserveHost On RewriteEngine On RewriteRule ?? </VirtualHost>

这里的任何潜在顾客都非常感激.

Any leads here is really appreciated.

推荐答案

您可以使用(代替RewriteRule ??):

RewriteCond %{QUERY_STRING} (?:^|&)product=([^&]+) [NC] RewriteRule ^/?loadproduct$ someotherdomain/%1? [R=301,L,NC]

更多推荐

使用apache vhost配置重定向到新域

本文发布于:2023-11-02 06:45:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551656.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到新   重定向   apache   vhost

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!