程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了.htaccess 问题,我无法删除 .php大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决.htaccess 问题,我无法删除 .php

开发过程中遇到.htaccess 问题,我无法删除 .php的问题如何解决?下面主要结合日常开发的经验,给出你关于.htaccess 问题,我无法删除 .php的解决方法建议,希望对你解决.htaccess 问题,我无法删除 .php有所启发或帮助;

我需要你的帮助。 我有这个网址:www.myurl.com/?verfy=CDPOR888www.myurl.com/index.php?verfy=CDPOR888

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

请帮忙,我如何使用 .htaccess 来实现?

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

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

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

注意:.htaccess 不区分大小写

解决方法

请更换此规则!

RewriteENGIne On
RewriteCond %{requEST_FILename} !-f
# Use this rule
RewriteRule ^([^\.]+)$ $1.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=$1 [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=$1 [L]
</IfModule>

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

大佬总结

以上是大佬教程为你收集整理的.htaccess 问题,我无法删除 .php全部内容,希望文章能够帮你解决.htaccess 问题,我无法删除 .php所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。