网站php删除,用htaccess删除网站的php扩展

试试这条规则: –

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$$1.php

以下是规则如何运作的基本描述: –

常用表达

. (any character)

* (zero of more of the preceding)

+ (one or more of the preceding)

{} (minimum to maximum quantifier)

? (ungreedy modifier)

! (at start of string means "negative pattern")

^ (start of string, or "negative" if at the start of a range)

$(end of string)

[] (match any of contents)

- (range if used between square brackets)

() (group, backreferenced group)

| (alternative, or)

\ (the escape character itself)

使用正则表达式,可以在URL中搜索各种模式,并在匹配时重写它们

标志被添加到重写规则的末尾,以告诉Apache如何解释和处理规则.它们可用于告诉apache将规则视为不区分大小写,如果当前匹配则停止处理规则,或者使用各种其他选项.它们以逗号分隔,并包含在方括号中.这是一个标志列表及其含义.

C (chained with next rule)

CO=cookie (set specified cookie)

E=var:value (set environment variable var to value)

F (forbidden - sends a 403 header to the user)

G (gone - no longer exists)

H=handler (set handler)

L (last - stop processing rules)

N (next - continue processing rules)

NC (case insensitive)

NE (do not escape special URL characters in output)

NS (ignore this rule if the request is a subrequest)

P (proxy - i.e., apache should grab the remote content specified in the substitution section and return it)

PT (pass through - use when processing URLs with additional handlers, e.g., mod_alias)

R (temporary redirect to new URL)

R=301 (permanent redirect to new URL)

QSA (append query string from request to substituted URL)

S=x (skip next x rules)

T=mime-type (force specified mime type)

例外情况和特殊情况

重写条件可以通过几种不同的方式进行测试 – 它们不需要被视为正则表达式模式,尽管这是它们最常用的方式.以下是可以处理重写条件的各种方法:

>Pattern (is test string greater than pattern)

=Pattern (is test string equal to pattern)

-d (is test string a valid directory)

-f (is test string a valid file)

-s (is test string a valid file with size greater than zero)

-l (is test string a symbolic link)

-F (is test string a valid file, and accessible (via subrequest))

-U (is test string a valid URL, and accessible (via subrequest))

希望它能帮到你:)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值