Laravel 5.1 - 公用文件夹问题

时间:2015-12-19 15:48:55

标签: php ajax laravel laravel-5.1 public

我在Windows服务器上安装了laravel(使用IIS 8.5),我在从URL中删除公用文件夹时遇到问题。我设法将laravel的公共文件夹作为我的域的根文件夹解决了这个问题,但是,通过ajax提交表单我无法从URL中删除公用文件夹。例如:

我的域名是www.abc.com,我有一份表格,提交后需要发布到www.abc.com/login。但如果我不在网址中包含公众,我会收到404错误。如果我向www.abc.com/public/login发送ajax请求,它的工作原理非常好。

我还添加了我的web.config文件:

1. outside public folder( in httpdocs folder)

        <?xml version="1.0" encoding="UTF-8"?>
        <configuration>
            <system.webServer>
                <rewrite>
                  <rules>
                    <rule name="Imported Rule 11" stopProcessing="true">
                  <match url="^(.*)/$" ignoreCase="false" />
                  <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                  </conditions>
                  <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
                </rule>
                  </rules>
                </rewrite>
            </system.webServer>
        </configuration>


    2. inside public folder

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
         <rule name="Imported Rule 1" stopProcessing="true">
              <match url="^(.*)/$" ignoreCase="false" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
              <action type="Redirect" redirectType="Permanent" url="/{R:1}"/>
            </rule>
            <rule name="Imported Rule 2" stopProcessing="true">
              <match url="^" ignoreCase="false" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
              </conditions>
          <action type="Rewrite" url="index.php" />
            </rule> 
                </rules>
            </rewrite>    
        </system.webServer>
    </configuration>

我花了12个小时搜索很多论坛,但无法获得任何解决方案。任何帮助都将受到高度赞赏,因为我真的被困住了。谢谢

0 个答案:

没有答案