如何使用 .htaccess 将用户重定向到特定页面
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试添加重定向标志:
Try adding the redirect flag: