我用下面的code删除。html的延伸形式的URL,但它不工作。
任何一个可以帮助,在这里我必须把.htaccess文件
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_FILENAME} 。HTML -f
重写规则^([^ /] +)/ $ $ 1.HTML
解决方案
最后,我得到了正确的.htaccess code删除的.php延伸...:)
选项+了FollowSymLinks -MultiViews
#开启mod_rewrite的上
RewriteEngine叙述上
的RewriteBase /
##隐藏PHP扩展
#要外部重定向/dir/foo.php到/ DIR /富
的RewriteCond%{THE_REQUEST} ^ [AZ] {3,} S([^。] +)。PHP [NC]
重写规则^%1 [R,L,NC]
##在内部重定向/ DIR /富到/dir/foo.php
的RewriteCond%{} REQUEST_FILENAME -f .PHP
重写规则^%{REQUEST_URI}的.php [L]
I'm using the below code to remove .html extention form url, but it is not working..
can any one help , where i have to put the .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^([^/]+)/$ $1.html
解决方案
Finally I Got the correct .HTACCESS code to remove .php extention... :)
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]