Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

htaccess code to remove .php extension

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R=302,L,NE]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
Source by techglimpse.com #
 
PREVIOUS NEXT
Tagged: #htaccess #code #remove #extension
ADD COMMENT
Topic
Name
3+1 =