.htaccess remove php extension AND redirect
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]
精彩评论