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
如何在url中隐藏php扩展?_Php_.htaccess_Xampp - Fatal编程技术网

如何在url中隐藏php扩展?

如何在url中隐藏php扩展?,php,.htaccess,xampp,Php,.htaccess,Xampp,我在Windows7中使用“xampp”。 我将index.php放在localhost(root)下的文件夹中,路径类似于(http://localhost/folder/index.php) 我在文件夹下的“.htaccess”文件中添加了以下几行 RewriteEngine On RewriteRule index index.php [L] 但它不起作用。 帮帮我。试试这个 RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f

我在Windows7中使用“xampp”。 我将index.php放在localhost(root)下的文件夹中,路径类似于
(http://localhost/folder/index.php)
我在文件夹下的“.htaccess”文件中添加了以下几行

RewriteEngine On
RewriteRule index index.php [L]
但它不起作用。 帮帮我。

试试这个

RewriteEngine On

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1\.php
同时启用重写模块

尝试

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php?%{QUERY_STRING}
重新启动发动机 重写规则^index$index.php[NC,L]
@Rikesh我尝试了它不工作确保你的服务器上打开了
mod_rewrite
。@Rikesh是的,它的可用性确保设置为全部检查你的重写模块是否启用@Saini是的,它不工作了,在哪里放置“.htaccess”文件?@sufi,它工作了,启用mod_rewritenot working,在哪里放置“.htaccess”文件?“RewriteEngine On RewriteRule index.php index[L]”这在中工作正常,但在浏览器中不工作。 RewriteEngine On RewriteRule ^index$ index.php [NC,L]