[英]Remove “index.php” from URL
I have this link 我有这个连结
localhost/MySite/queues/index.php
本地主机/ MySite /队列/index.php
index.php has been removed using .htaccess and I got URL as follows. index.php已使用.htaccess删除,我得到的URL如下。
localhost/MySite/queues
本地主机/ MySite /队列
Now the problem is, when I use segment in my index function like this: 现在的问题是,当我在索引函数中使用细分时,如下所示:
queues.php --> controller queues.php->控制器
function index($sgmnt = 'test'){
$this->load->view('queues_view/'.$sgmnt);
}
I want to have this link 我想要这个连结
localhost/MySite/queues/test
本地主机/ MySite /队列/测试
NOT 不
localhost/MySite/queues/index.php/test
本地主机/ MySite /队列/index.php/测试
or I can still type 或者我仍然可以输入
localhost/MySite/queues/index.php/test
本地主机/ MySite /队列/index.php/测试
but URL must show only 但网址只能显示
localhost/MySite/queues/test
本地主机/ MySite /队列/测试
With the above config setting 通过以上配置设置
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
for this you can take advantage of htaccess.open htaccess and add these lines in to that. 为此,您可以利用htaccess.open htaccess并在其中添加这些行。 i hope it will work(
http://localhost/MySite/queues/test
). 我希望它会工作(
http://localhost/MySite/queues/test
)。
RewriteEngine On
RewriteRule ^MySite/queues/test$ /MySite/queues/index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.