MOD_Rewrite 重定向 URL
我有不同的 URL 和不同的查询。
即
我有 mysite.com/login.php?u=user&pass=pass
我想重定向到 mysite.com/newsite/login.php?u=user&pass=pass
或者
我有 mysite.com/show?forum +id=34&topic=8
我想重定向到 mysite.com/newsite/show?forum+id=34&topic=8
我有大约 30 个链接,我想重定向到新闻网站 文件夹。
有没有一种方法可以重定向,而不必在 htaccess 中设置所有 url。
I have different URLS and different querys.
i.e.
I have mysite.com/login.php?u=user&pass=pass
i want to redirect to mysite.com/newsite/login.php?u=user&pass=pass
or
I have mysite.com/show?forum+id=34&topic=8
i want to redirect to mysite.com/newsite/show?forum+id=34&topic=8
i have about 30 links i would like to redirect to the newsite folder.
Is there wa way to redirect with out having to set all the urls in htaccess.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将其放入 .htaccess 文件中:
这将重定向,例如:
至:
编辑:
抱歉,我没有意识到您想要对多个网址执行此操作,而不需要每个网址都有一个。我认为这可能有效,但我还没有测试过。
如果它不起作用,您可能需要在最后一行的 ^.com 后面添加一个 /。
You can put this in your .htaccess file:
This will redirect, for example:
to:
Edit:
Sorry, I didn't realise you wanted to do this with multiple URLs without having one for each one. I think this might work, but I haven't tested it.
If it doesn't work, you might need a / after the ^.com in the last line.