我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用.htaccess将具有查询字符串的URL重定向到404页面

I want to redirect "http://www.example.com/?ac=2&slt=8&slr=1&lpt=1" this url to 404 page through .htaccess. Please provide solution.
Thanks

Add this rule to your document root's htaccess file:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^ac=2&slt=8&slr=1&lpt=1$ 
RewriteRule ^/?$ - [L,R=404]

Detail document for modrewrite and htaccess :

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

You can generate custom htaccess file with:

http://www.htaccessredirect.net/

近期文章

  • 警告:mysqli_fetch_row()期望参数1为mysqli_result
  • 在Android应用程序中与远程MySQL数据库交互
  • 只有在包含确定子字符串时才获取字符串的一部分
  • Php会话变量错误
  • 在PHP中抓取部分URL [关闭]
  • 生成查询到数据库的php函数[关闭]
  • 使用php从表中按顺序排列数据
  • PHP / Laravel / Bootstrap获取数据
  • PHP错误使它做其他[关闭]
  • 如何处理错误codeigniter
  • 将文本拆分为130个字符长的部分[关闭]
  • 如何从PHP获取价值并在javascript中使用
  • 将地址栏中的url设置为php中的用户名[复制]
  • PHP while循环不能在Bootstrap的modal中工作
  • mysql assoc错误
  • Mysql查询似乎不起作用
  • 我需要php Homework的帮助
  • php发布到电子邮件
  • PHP没有执行
  • 更改下拉列表/复选框选项

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华