URL 重写 - 自动 - 非手动

发布于 2024-09-13 10:22:48 字数 422 浏览 3 评论 0原文

我在 .htaccess 文件中编写了重定向规则 如果我们手动提供该链接,它会重定向某些页面。 但我想要的是,它应该自动重定向......

我的要求是:

而不是这个链接,

links.php?page=1&ipp=All&exchange=adddata

它应该自动重定向

http://example.com/folder1/links/1/All/exchange.html

我在.htaccess中的规则是

RewriteEngine On RewriteRule ^([0-9]+)/All/exchange.html$ links.php?page=1&ipp=All&exchange=adddata

I have written a rule for redirecting in .htaccess file
its redirecting for some pages , if we give that link manually..
but what i want is ,it should redirect automatically....

My requirement is :

Instead of this link,

links.php?page=1&ipp=All&exchange=adddata

It should be redirected automatically

http://example.com/folder1/links/1/All/exchange.html

MY rule in .htaccess is

RewriteEngine On
RewriteRule ^([0-9]+)/All/exchange.html$ links.php?page=1&ipp=All&exchange=adddata

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橙幽之幻 2024-09-20 10:22:48

您的示例并不完全清楚,但可能是这样的:

RewriteEngine On   
RewriteRule ^links.php?page=([0-9]+)&ipp=All&exchange=adddata$  folder$1/links/$1/All/exchange.html

在上面的评论中,您错误地交换了原始网址和应该重定向到的网址,而且您没有在新网址中设置任何动态参数 - 我想您需要。但正如我所说,为了确定这一点,我们需要更多的例子。

希望这有帮助!

It's not completely clear by your example, but it could be this:

RewriteEngine On   
RewriteRule ^links.php?page=([0-9]+)&ipp=All&exchange=adddata$  folder$1/links/$1/All/exchange.html

In the comment above you mistakenly swaped the original url and the url it should be redirected to plus you didn't set any dynamic parameters in your new url - which I suppose you need. But as I said, to be sure about it we'd need more examples.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文