如何在url中隐藏php扩展?
我在Windows7中使用“xampp”。 我将index.php放在localhost(root)下的文件夹中,路径类似于如何在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
(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]