.htaccess 问题,我无法删除 .php

.htaccess problems, impossible for me to remove .php

我需要你的帮助。 我有这个 url: wwww.myurl.com/?verfy=CDPOR888wwww.myurl.com/index.php?verfy=CDPOR888

我想变成这样:wwww.myurl.com/CDPOR888

请帮忙,我怎样才能用 .htaccess 做到这一点?

我在 .htaccess 中尝试了这段代码,但没有用:

RewriteRule ^([^/]*)\.php$ /?perms_verify= [QSA,L,NC]

但问题是。php,当我删除它时出现错误。

注意:.htaccess 不区分大小写

Please replace this rule!

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
# Use this rule
RewriteRule ^([^\.]+)$ .php [NC,L]

您可以只使用这条规则:

RewriteEngine On

# request is not for a file
RewriteCond %{REQUEST_FILENAME} !-f
# request is not for a directory
RewriteCond %{REQUEST_FILENAME} !-d
# rewrite to destination path
RewriteRule ^([\w-]+)/?$ ?verfy= [QSA,L]

将您的 .htaccess 文件更新为

DirectoryIndex index.php

# remove the next 3 lines if you see a 500 server error


FileETag none
ServerSignature Off

Options All -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([0-9a-zA-Z_-]{1,16})$ index.php?verify= [L]
</IfModule>

在 wwww.myurl.com/index.php 页面上,编写逻辑以使用 GET 方法捕获验证值并执行进一步的操作