-2
因此,我最近为我的一个网站编写了一个PHP API,但我试图将其删除?.htaccess不删除这个:index.php?
随着index.php
让我们说,我去http://api.url.com/index.php?Method
我可以真的去http://api.url.com/Method和它的工作一样会。
我试过其他.htaccess的但似乎没有任何工作。
因此,我最近为我的一个网站编写了一个PHP API,但我试图将其删除?.htaccess不删除这个:index.php?
随着index.php
让我们说,我去http://api.url.com/index.php?Method
我可以真的去http://api.url.com/Method和它的工作一样会。
我试过其他.htaccess的但似乎没有任何工作。
写下面的代码在.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
这是行不通的。我已经重新启动apache2。它只是404时,我去http://api.url.com/Method=Test (我用我的网址替换url.com) –
显示我的编辑答案 –
这也不起作用。我已经确认mod_rewrite已启用并安装在我的ubuntu 14.04 apache2安装中。它仍然会返回一个404 –