简体   繁体   中英

Having trouble removing PHP extension

On my website I have been trying to remove the PHP extension's on every page; I am worried that I may interfere with the SEO and end up glitching the site.

I have tried alot of methods on the internet but none of them seem to be working ? Maybe I am doing something wrong, or it's an internal control panel error ?

Code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

No results from this or any others, advice ?

This has always worked for me:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

In one project here we used:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Which you could try as well

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