htaccess 重写基本 url
任何擅长 htaccess 和 mod 重写的人 - 我需要你的帮助!
我需要重写 url 的基本部分。
例如,所有对 http://domain1.com 的请求都需要转到 http://domain2.com
请求通常采用以下形式:
http://domain1.com/main/test?q=1
然后我需要去 http://domain2.com/main/test?q=2
请帮忙!
提前致谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的 .htaccess 文件中尝试此操作:
R=301
将使用 https 状态 301 进行重定向L
将制定最后一条规则NE
用于无转义查询字符串QSA
将附加您现有的查询参数$1
是您的 REQUEST_URITry this in your .htaccess file:
R=301
will redirect with https status 301L
will make last ruleNE
is for no escaping query stringQSA
will append your existing query parameters$1
is your REQUEST_URI跨多个域重写 URL?考虑到 Apache 的请求处理算法,我不完全确定这是否可行。您正在寻找重定向,而不是重写。
Rewriting URL's across multiple domains? I'm not entirely sure this can work, considering Apache's request-handling algorithm. You're looking for a redirect, not rewrite.