“Retirez .php de l'URL” Réponses codées

PHP Retirez l'extension de l'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

supprimer le html de la chaîne php

echo strip_tags("Hello <b>world!</b>");
Beautiful Bug

Retirez .php de l'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

Réponses similaires à “Retirez .php de l'URL”

Questions similaires à “Retirez .php de l'URL”

Plus de réponses similaires à “Retirez .php de l'URL” dans PHP

Parcourir les réponses de code populaires par langue