Hide Php Extension Htaccess

[Solved] Hide Php Extension Htaccess | Php - Code Explorer | yomemimo.com
Question : hide php extension htaccess

Answered by : innocent-ibex-9qyx02euzhz2

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
#This works with xxx/index.php too (visiting mysite.com/xxx/)

Source : | Last Update : Mon, 05 Jul 21

Question : how to hide .php extension using .htaccess

Answered by :

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

Source : https://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/ | Last Update : Sat, 20 Mar 21

Question : remove .php from url

Answered by : obedient-otter-gghhjw1exycp

# Apache Rewrite Rules <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase /
# Add trailing slash to url RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$ RewriteRule ^(.*)$ $1/ [R=301,L]
# Remove .php-extension from url RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^\.]+)/$ $1.php
# End of Apache Rewrite Rules </IfModule>

Source : https://stackoverflow.com/questions/21617506/remove-html-and-php-extensions-with-htaccess | Last Update : Fri, 06 Nov 20

Answers related to hide php extension htaccess

Code Explorer Popular Question For Php