.htaccess重定向当index.php文件从url中删除时获取的url错误

时间:2015-05-04 04:49:29

标签: php .htaccess url-rewriting

我在.htaccess文件中遇到了一些问题。我希望重定向并避免使用url中的index.php文件。

我的第一个网址是

 www.hestiamedicare.com/web/index.php/contact

以上链接转换为

 www.hestiamedicare.com/web/contact.

1 个答案:

答案 0 :(得分:0)

它就像Yii框架web结构。 如果为true,则只需从urlManager启用漂亮的URL

'enablePrettyUrl'=>true

如果没有,请在.htaccess中使用此代码将所有请求(不直接写入文件或文件夹)重写为index.php:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^ index.php [L]

然后处理索引文件中的请求URL。