使用 .htaccess 进行简单(?)重定向

发布于 2024-09-24 15:59:30 字数 251 浏览 1 评论 0原文

这可能很简单,但我不知道该怎么做。

我想要这种形式的所有链接: http://www.fractalbit.gr/archives/xxx 重定向到此: http://www.fractalbit.gr/?p=xxx

this is probably simple but i don't know how to do it.

I want all links of this form: http://www.fractalbit.gr/archives/xxx
to redirect to this: http://www.fractalbit.gr/?p=xxx

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

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

发布评论

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

评论(2

烂柯人 2024-10-01 15:59:30
RedirectMatch .*\/archives\/(.+) http://www.fractalbit.gr/?p=$1

Apache 文档中的 RedirectMatch

RedirectMatch .*\/archives\/(.+) http://www.fractalbit.gr/?p=$1

RedirectMatch in Apache docs

北城孤痞 2024-10-01 15:59:30

像这样的东西吗?

RewriteEngine on
RewriteRule ^archives/(.+)$ ?p=$1

然而,一切都取决于您是否被允许以这种方式使用 .htaccess。网络主机并不总是允许这样的事情。

PS:这称为重写而不是重定向,但我认为这就是你的意思。

Something like this?

RewriteEngine on
RewriteRule ^archives/(.+)$ ?p=$1

All depends however, a lot on whether you are allowed to use .htaccess in such a way. Stuff like this is not always permitted by webhosts.

PS: this is called rewriting as opposed to redirecting, but I think this is what you mean.

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