Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用.htaccess规则删除.php扩展名?_Php_.htaccess_Mod Rewrite - Fatal编程技术网

如何使用.htaccess规则删除.php扩展名?

如何使用.htaccess规则删除.php扩展名?,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我需要我的.htaccess文件去掉.php文件扩展名,并将其替换为一个尾随斜杠 此外,我还有一个profile.php页面,通常会使用一个数字querystring参数访问该页面,如“profile.php?id=3” 那么,除了用斜杠替换扩展之外,我如何使“profile.php?id=3”看起来像“profile/3/” 到目前为止,我只有第一行: RewriteEngine on 我该从这里走到哪里?如果你是新来的。。。你真的应该 但这会满足你的要求。别偷懒了。阅读手册 如果你是新来的

我需要我的.htaccess文件去掉.php文件扩展名,并将其替换为一个尾随斜杠

此外,我还有一个profile.php页面,通常会使用一个数字querystring参数访问该页面,如“
profile.php?id=3

那么,除了用斜杠替换扩展之外,我如何使“
profile.php?id=3
”看起来像“
profile/3/

到目前为止,我只有第一行:

RewriteEngine on

我该从这里走到哪里?

如果你是新来的。。。你真的应该


但这会满足你的要求。别偷懒了。阅读手册

如果你是新来的。。。你真的应该

但这会满足你的要求。别偷懒了。阅读手册

这应该可以

RewriteRule ^profile/(.*)$ profile.php?id=$1 [NC,L]
这应该可以

RewriteRule ^profile/(.*)$ profile.php?id=$1 [NC,L]

可能重复可能重复毫无意义地告诉他在你为他完成工作后不要偷懒:P@MrXexxed,你说得对。。。你说得对。。。不应该有!:)在你为他完成工作后告诉他不要偷懒是毫无意义的:P@MrXexxed,你说得对。。。你说得对。。。不应该有!:)