I know how to redirect pages, but I was wondering how I could remove the .php extension as well as redirect?
Here's what I have so far:
<Files .htaccess>
order allow,deny
</Files>
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(\w+)$ ./load.php?code=$1
Thank you in advance,
I saw a thread here discuss the same issue. http://www.webmasterworld.com/apache/4148146.htm
You can use this answer in that topic of jDMorgan It will check if the request is not assets files and if it exist extension php in the url, they will redirect and remove .php
RewriteRule %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|zip)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ [b]/$1[/b].php [b][L][/b]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.