使用 mod_rewrite 删除 PHP 路径详细信息

发布于 2024-10-09 08:41:38 字数 373 浏览 0 评论 0原文

我似乎无法使用 mod_rewrite 将示例 1 变成示例 2。

示例1

http://www.example.com/info/index.php?uid=123

示例2

http://www.example.com/123

Mod 重写代码。

Options +FollowSymLinks
Options -Indexes
RewriteEngine on
RewriteBase /info

RewriteRule ^([^/]*)$ /info/index.php?uid=$1 [L]

接下来我可以尝试什么?

I can't seem to get Example 1 to turn into Example 2 using mod_rewrite.

Example 1

http://www.example.com/info/index.php?uid=123

Example 2

http://www.example.com/123

Mod rewrite code.

Options +FollowSymLinks
Options -Indexes
RewriteEngine on
RewriteBase /info

RewriteRule ^([^/]*)$ /info/index.php?uid=$1 [L]

What can I try next?

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

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

发布评论

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

评论(1

吃颗糖壮壮胆 2024-10-16 08:41:38
RewriteCond %{HTTP_HOST} ^www.example.com(:80)?$ [NC]        
RewriteCond %{QUERY_STRING}     ^uid=(.*)$    [NC]
RewriteRule ^/info/index\.php$ http://www.example.com/%1? [NC,L,R=301]
RewriteCond %{HTTP_HOST} ^www.example.com(:80)?$ [NC]        
RewriteCond %{QUERY_STRING}     ^uid=(.*)$    [NC]
RewriteRule ^/info/index\.php$ http://www.example.com/%1? [NC,L,R=301]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文