gpt4 book ai didi

.htaccess - 通过 mod_rewrite 重定向和重写 URL

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:39:07 27 4
gpt4 key购买 nike

我的主播是这样的

<a href="http://localhost/haveg/employer?id=7003&title=the-message-title">employer</a>

当我点击 anchor 时,我想到达这里

http://localhost/haveg/employer/7003/the-message-title

到目前为止,我已经编写了这个 .htacess 代码

Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^haveg/employer/([0-9]+)/?(.*) haveg/employer.php?id=$1

只有在我输入 http://localhost/haveg/employer/7003/the-message-title 时才会打开页面,但我想在单击 anchor 后到达这里。

谢谢。

最佳答案

我想这就是你想要的:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^haveg/employer/([0-9]+){1,5}/?(.*) haveg/employer.php?id=$1&title=$2 [L,NC]

你的 anchor 必须像这样构建:

<a href="/haveg/employer/7003/the-message-title">employer</a>

关于.htaccess - 通过 mod_rewrite 重定向和重写 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9075514/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com