php - 关闭对非链接在 htaccess 中重写的页面的访问
问题描述
我编写的 htaccess 代码使我的 url seo 友好
RewriteEngine on
RewriteBase /
RewriteRule ^p/([^/]+)/([^/]+)$ page.php?id=$1&title=$2 [QSA]
真正的页面访问格式是page.php?id={id}&title={title}
.
并使用 htaccessp/{id}/{title}
所以我想停止page.php
使用真实格式的访问。那可能吗 ?
解决方案
尝试使用低于当前重写规则的以下规则,
RewriteCond %{REQUEST_FILENAME} ^page.php
RewriteCond %{QUERY_STRING} ^id=$1&title=$2
RewriteRule ^ - [F]
推荐阅读
- typescript - 打字稿记录,无需手动键入键
- javascript - 如何在 svelte 文件中使用电子方法 - Svelte 3 - 还是有其他方法可以做到这一点?
- algorithm - 水合节点
- gremlin - 找不到类的类型标识符:class java.lang.Short
- wordpress - 如果有 2 级,则将唯一的类添加到 0 级
- typescript - PIXI js 加载资产导致缓存警告我纹理已加载到缓存中
- spring-boot - 增加 OAuth 客户端
- c# - 值不能为空。参数名称:path1
- javascript - 在 HTML 表格中输入数据
- javascript - onkeypress() 未调用函数