Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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_Hide_File Extension - Fatal编程技术网

如何在.htaccess中用一行代码隐藏php扩展

如何在.htaccess中用一行代码隐藏php扩展,php,.htaccess,hide,file-extension,Php,.htaccess,Hide,File Extension,我想问的是,不要在.htaccess中写很多行,包括隐藏扩展名的所有页面 RewriteRule^about$about.php[L] 重写规则^register$register.php[L] 重写规则^login$login.php[L] 重写规则^dashboard$dashboard.php[L] 重写规则^logout$logout.php[L] 是否有任何单行代码可以执行相同的操作?嗨,Laurenz Albe,您对我的问题有何修改?您只删除了“提前谢谢”文本?是否有必要删除该部分

我想问的是,不要在.htaccess中写很多行,包括隐藏扩展名的所有页面

RewriteRule^about$about.php[L]
重写规则^register$register.php[L]
重写规则^login$login.php[L]
重写规则^dashboard$dashboard.php[L]
重写规则^logout$logout.php[L]

是否有任何单行代码可以执行相同的操作?

嗨,Laurenz Albe,您对我的问题有何修改?您只删除了“提前谢谢”文本?是否有必要删除该部分?我只是想学习。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]