RewriteBase URL -path
设置了目录级重写的基准URL
RewriteEngine on
RewriteBase /test
RewriteRule ^(.*)\.htm$ $1.html
RewriteCond 语法说明
RewriteCond TestString CondPattern
- TestString使用说明
- $1-9引用紧跟在RewriteCond后面的RewriteRule中模板中匹配的数据
- 实际应用如下
RewriteEngine on
RewriteCond $1 "test"
RewriteRule ^(.*)\.htm $1.html
Not Found
The requested URL /123.htm was not found on this server.
Apache/2.4.35 (Win64) PHP/5.6.38 Server at 127.0.0.1 Port 80
就转到了http://127.0.0.1/test.html
这就是最简单的RewriteCond