从具有的.htaccess URL删除“的index.php” [英] Remove 'index.php' from URL with .htaccess
本文介绍了从具有的.htaccess URL删除“的index.php”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试各种从本网站解决方案,并没有似乎工作。我目前的托管与HostGator的。这是我目前的.htaccess文件:
I've been trying all sorts of solutions from this site and none seem to work. I'm currently hosting with hostgator. This is my current .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/user/php.ini
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
这是在我的网站的根文件夹。我也尝试添加?
在的index.php
并没有运气。有谁知道这是为什么不工作?
This is in the root folder of my site. I have also tried adding a ?
after index.php
and no luck. Does anyone know why this isn't working?
推荐答案
这是在code,你可以在你的.htaccess(下DOCUMENT_ROOT)用于从URI删除的index.php:
This is the code you can use in your .htaccess (under DOCUMENT_ROOT) to remove index.php from URI:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
RewriteRule ^ %1 [R=301,L]
这篇关于从具有的.htaccess URL删除“的index.php”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文