通过 mod_rewrite 重定向并重写 URL
我的锚点是这样的
<a href="http://localhost/haveg/employer?id=7003&title=the-message-title">employer</a>
当我单击锚点时,我想到达这里,
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
但我想在单击锚点后到达这里。
谢谢。
My anchor is like this
<a href="http://localhost/haveg/employer?id=7003&title=the-message-title">employer</a>
And when i click the anchor i want to reach here
http://localhost/haveg/employer/7003/the-message-title
so far i have written this .htacess code
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^haveg/employer/([0-9]+)/?(.*) haveg/employer.php?id=$1
which only opens the page when i type http://localhost/haveg/employer/7003/the-message-title
but i want to reach here after i click the anchor.
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这就是你想要的:
你的锚点必须像这样构建:
I think this is what you want:
Your anchor would have to be built like:
Mod 重写不会重定向您必须放置的链接
http://localhost/haveg/employer/7003/the-message-title
在你的锚中,mod rewrite 所做的就是加载
http://localhost/haveg/employer?id=7003&title=the -消息标题
在后台并显示它
Mod rewrite doesn't redirect links you have to put
http://localhost/haveg/employer/7003/the-message-title
in your anchor what mod rewrite does is it will load
http://localhost/haveg/employer?id=7003&title=the-message-title
in the background and display it