Apache .htaccess 将目录重定向到查询字符串

发布于 2024-08-23 03:12:59 字数 173 浏览 2 评论 0原文

我想将我网站上的请求从

host.com/directory

重定向到

host.com/?institution=directory

以便用户可以访问我网站的主要级别类别使用目录表示法 我只是很难理解正则表达式,任何帮助将不胜感激

i would like to redirect requests on my site from

host.com/directory

to

host.com/?institution=directory

so that users can access the main level categories of my site using a directory notation
I just have a hard time wrapping my head around the regex, any help would be appreciated

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

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

发布评论

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

评论(2

一页 2024-08-30 03:12:59

你可以使用

RewriteEngine On
RewriteRule ^(directory)$ /?institution=$1 [QSA,L]

You could use

RewriteEngine On
RewriteRule ^(directory)$ /?institution=$1 [QSA,L]
八巷 2024-08-30 03:12:59

重写引擎开启
RewriteRule ^([az-]+)$ /?机构=$1 [L,QSA]
RewriteRule ^([az-]+)/$ /?机构=$1 [L,QSA]

RewriteEngine On
RewriteRule ^([a-z-]+)$ /?institution=$1 [L,QSA]
RewriteRule ^([a-z-]+)/$ /?institution=$1 [L,QSA]

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