[英]how to fix url with htacces
我有一个最初为http://web.com/index.php/home/funct/的URL,我想通过删除index.php来更改它,使其变为http://web.com/home/funct/
如果您使用的是Apache服务器,请创建一个名为.htaccess
的文件并将其放入其中:
<IfModule mod_rewrite.c>
RewriteEngine on
# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
然后只需从链接中删除对“ /index.php/”的引用,当服务器找不到“ home / funct”时,它将去寻找“ /index.php/home/funct”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.