Remove .php Using .htaccess File
# 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
#For error page
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /errors/404.php [L]
RewriteCond %{REQUEST_URI} ^/503/$
RewriteRule ^(.*)$ /errors/503.php [L]
<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
#For error page
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /errors/404.php [L]
RewriteCond %{REQUEST_URI} ^/503/$
RewriteRule ^(.*)$ /errors/503.php [L]
Comments
Post a Comment