![](/img/trans.png)
[英]How to remove index.php from url slim framework setting VirtualHost?
[英]How can I remove the index.php from url using slim framework?
我有這個網址:
http://localhost:8082/sistemaTareas/api/index.php/hello/jean/bergeret
打印:
HELLO JEAN BERGERET
我需要這樣做,但是要這樣做:
http://localhost:8082/sistemaTareas/api/hello/jean/bergeret
我需要配置.htaccess嗎?
編輯:我看到了另一個答案,但沒有解決我的問題。 誰能指導我?
我認為您的網站apache配置中缺少AllowOverride All
,以激活您的.htaccess。
您的配置文件應如下所示:
<VirtualHost *:80>
ServerName my.server.name
DocumentRoot /path/to/your/website/root
<Directory /path/to/your/website/root >
DirectoryIndex index.php
AllowOverride All <!--Here-->
</Directory>
</VirtualHost>
和您的.htaccess像:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.