简体   繁体   中英

Want to display .php file as without extension?

my url is :http://www.example.com/home.php i want to show it when enduser navigates my site as http://www.example.com/home . I know this can be done through .htaccess file.

Following is the htacces file:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php 

Nothing is happening with the above code in .htaccess file.I want to show entire site pages without .php extension.Can anyone suggest me how to do this

Try this

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.php -f
  RewriteRule ^(.*)$ $1.php
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM