.htaccess重定向到index.html并且index.php不能一起工作

时间:2015-08-23 19:50:16

标签: angularjs apache .htaccess mod-rewrite slim

我有一个前端为angularjs的项目,后端api为sl​​im。因此,我想将任何api /(...)映射到server / index.php,并将其他任何内容映射到index.html。但是,我无法让它们与.htaccess一起工作。 api /(...)将指向index.html而不是index.php。

这是我使用的htaccess:

<blockquote>
  <p>Paragraph 1.</p>
  <p>Paragraph 2.</p>
</blockquote>
<p>
  Paragraph 3 with a <q>short quotation</q>.
</p>

这是我现在拥有的文件结构(省略了一些文件):

RewriteEngine on
RewriteBase /
RewriteRule ^api/ server/index.php [L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !\.private/
RewriteRule \.(jpg|png|js|css|html)$ - [L]
RewriteRule ^.* index.html [L]

我尝试在.htaccess文件中添加一些随机字符,并得到500错误,因此.htaccess文件有效。我还尝试删除index.html规则的最后一行,并在注释掉后使用api。

请帮我解决这个问题,谢谢!

0 个答案:

没有答案
相关问题