【问题标题】:Convert web.config file to .htaccess PHP将 web.config 文件转换为 .htaccess PHP
【发布时间】:2017-05-16 16:29:16
【问题描述】:

谁能帮我将此 web.config 文件转换为 .htaccess。

我正在尝试在 google 上搜索,但无法找到所需的结果。

这是我的网络配置。

<rules>
    <rule name="HTTP api" stopProcessing="true">
        <match url="^(.*/)?api/(.*)$" ignoreCase="true"/>
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile"
                ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory"
                ignoreCase="false" negate="true" />
        </conditions>
        <action type="Rewrite" url="{R:1}api/http.php/{R:2}"/>
    </rule>
    <rule name="Site pages" stopProcessing="true">
        <match url="^(.*/)?pages/(.*)$" ignoreCase="true"/>
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile"
                ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory"
                ignoreCase="false" negate="true" />
        </conditions>
        <action type="Rewrite" url="{R:1}pages/index.php/{R:2}"/>
    </rule>
    <rule name="Staff applications" stopProcessing="true">
        <match url="^(.*/)?scp/apps/(.*)$" ignoreCase="true"/>
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile"
                ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory"
                ignoreCase="false" negate="true" />
        </conditions>
        <action type="Rewrite" url="{R:1}scp/apps/dispatcher.php/{R:2}"/>
    </rule>
</rules>

【问题讨论】:

    标签: .htaccess mod-rewrite iis web-config web.config-transform


    【解决方案1】:

    试试:

    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule "^(.*/)?api/(.*)$" $1api/http.php/$2 [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule "^(.*/)?pages/(.*)$" $1pages/index.php/$2 [NC]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule "^(.*/)?scp/apps/(.*)$" $1scp/apps/dispatcher.php/$2 [NC]
    

    【讨论】:

      猜你喜欢
      • 2017-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多