“Como ocultar a extensão .php usando .htaccess” Respostas de código

PHP Remova a extensão do URL

//put this piece of code in the root file .htaccess
RewriteEngine on
#remove extension html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]

#remove extension php
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
Apollo

ocultar a extensão php htaccess

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/)
Innocent Ibex

Como ocultar a extensão .php usando .htaccess

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

Remova .php do URL

# 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>
Obedient Otter

Respostas semelhantes a “Como ocultar a extensão .php usando .htaccess”

Perguntas semelhantes a “Como ocultar a extensão .php usando .htaccess”

Mais respostas relacionadas para “Como ocultar a extensão .php usando .htaccess” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código