Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Rewrite .php file without .php extension with .htaccess ULTIMATE SOLUTION

Options +MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

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

# To internally redirect /dir/foo/ to /dir/foo.php
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
#NOTE: the above will rewrite file eg. about.php to about/

#NOTE: rewrite to about/ to about or login/ to login, etc.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
Comment

PREVIOUS NEXT
Code Example
Php :: downgrade php PHP 8.0.11 to 7.4 on windows 
Php :: php browser cache clear 
Php :: php send POST request same folder 
Php :: loop IlluminateSupportCollection Object ( [items:protected] = 
Php :: Laravel Http client retry request if fail 
Php :: php group subarrays by column key 
Php :: devilbox make database 
Php :: Remove default product data tabs 
Php :: folder name escape php 
Php :: remove public url laravel 
Php :: provenienza geografica di un utente php webmaster 
Php :: command line that convert html to php file 
Php :: Best Performance monitoring tools for php 
Php :: how to use cornjob on live server in laravel 
Php :: php get image from folder as array 
Php :: laravel collection flip 
Php :: php mysql foreach is bad pardics ? 
Php :: ajax php example 
Php :: collection methods laravel 
Php :: spatie media library 
Php :: laravel verification email 
Php :: how to print any string in double quotes in php 
Php :: enable cors cakephp 
Php :: learn php 
Php :: add column to matrix php 
Java :: how to iterate through an array backwards java 
Java :: how to loop javafx media player 
Java :: string to date conversion java 
Java :: age in java 
Java :: android how to split string 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =