使用.htaccess从网址中删除.php [英] removing .php from the url using .htaccess
本文介绍了使用.htaccess从网址中删除.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试消除文件扩展名.php,并添加一个/来打开它以进行正向url堆栈.当然要牢记无限循环.这就是我在htaccess文件中所拥有的.我做错了什么?
I am trying to eliminate my file extension .php and add a / to open it for forward url stacking. With of course keeping infinite loops on mind. This is what I have in htaccess file. What am I doing wrong?
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# Removes index.php from ExpressionEngine URLs
<IfModule mod_rewrite.c>
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
谢谢
Thank you
推荐答案
[NC] RewriteRule ^ http://www.% {HTTP_HOST}%{REQUEST_URI} [R = 301,L] < /IfModule > #从ExpressionEngine URL中删除index.php < IfModule > RewriteCond
[NC] RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] </IfModule> # Removes index.php from ExpressionEngine URLs <IfModule mod_rewrite.c> RewriteCond
1!\.(gif | jpe?g | png)
1 !\.(gif|jpe?g|png)
[NC] RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule ^(.*)
[NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)
这篇关于使用.htaccess从网址中删除.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文