Apache 重定向永久用于字符串中包含数据的 URL(问号)

发布于 2025-01-03 17:58:30 字数 211 浏览 3 评论 0原文

我正在寻找一个 Apache 重定向,其中源 URL 中有一个问号。

Redirect permanent /course/view.php?id=68 http://exmaple.com/page.php

我尝试过逃避问号,但这不起作用。 我在网上读过一些关于使用重写条件的页面,但是它对我来说不太有意义,或者它与我想要完成的有点不同。

I am looking for an Apache redirect where the source URL has a question mark in it.

Redirect permanent /course/view.php?id=68 http://exmaple.com/page.php

I've tried escaping the question mark, but that doesn't work.
I've read a couple pages on the web about using Rewrite conditions, however it didn't quite make sense to me, or it was a little bit different than what I wanted to accomplish.

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

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

发布评论

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

评论(1

瞎闹 2025-01-10 17:58:30

尝试将以下内容添加到站点根目录中的 .htaccess 文件中。

RewriteEngine on
RewriteBase / 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /course/view\.php\?id=68 [NC]  
RewriteRule ^ http://exmaple.com/page.php [L,R=301]   

Try adding the following to the .htaccess file in the root directory of your site.

RewriteEngine on
RewriteBase / 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /course/view\.php\?id=68 [NC]  
RewriteRule ^ http://exmaple.com/page.php [L,R=301]   
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文