如何使用 .htaccess 将用户重定向到特定页面

发布于 2024-08-24 05:46:31 字数 567 浏览 1 评论 0原文

我在 Web 应用程序根目录的 .htaccess 文件中定义了以下规则。


RewriteCond %{REQUEST_URI} !^/classes/captcha.php
RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [L]


此规则提供了输入像 xyz.com/abc/page1 这样的 url 的便利,其原始内容等于 xyz.com/index.php?client=abc&page=page1
现在我想要的是,当用户输入 http://xyz.com/abc/page1 时,浏览器的地址栏应该显示原始网址,即 'http:// xyz.com/index.php?client=abc&page=page1'
目前,如果我输入“http://xyz.com/abc/page1”,地址栏网址不会改变。

请帮我修改一下这条规则。

谢谢。

I have the following rule defined in the .htaccess file of my webapplication's root directory.


RewriteCond %{REQUEST_URI} !^/classes/captcha.php
RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [L]

this rule give the facility of typing the url like this xyz.com/abc/page1 which is in original is equal to xyz.com/index.php?client=abc&page=page1

Now what I want is that when a user types in http://xyz.com/abc/page1, the address bar of the browser should display the original url i.e. 'http://xyz.com/index.php?client=abc&page=page1'
currently if I type "http://xyz.com/abc/page1" the address bar url doesn't change.

Please help me modify this rule.

Thanks.

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

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

发布评论

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

评论(1

猥︴琐丶欲为 2024-08-31 05:46:31

尝试添加重定向标志:

RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [R=301, L]

Try adding the redirect flag:

RewriteRule ^([^/]*)/([^/]*)$ /index.php?client=$1&page=$2 [R=301, L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文