• <kbd id="sesu6"><pre id="sesu6"></pre></kbd>
    
    
    Home - development tool
     Collection

    Pseudo-static Conversion

    Sometimes when it is necessary to convert IIS, Apache, nginx and caddy2, a long pseudo-static section needs to be rewritten. At this time, you can use this tool to quickly convert.

    <?xml version="1.0" encoding="UTF-8"?>
                    <configuration>
        <system.webServer>
    
            <rewrite>
                <outboundRules>
                    <preConditions>
                        <preCondition name="ResponseIsHtml1">
                            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html"/>
                        </preCondition>
                    </preConditions>
                </outboundRules>
                <rules>
                    <clear/>
                    <rule name="thinkphp">
                        <match url="^(?!css)(.*).html$"/>
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                        <action type="Rewrite" url="/index.php?s={R:1}"/>
                    </rule>
                    <rule name="thinkphp">
                        <match url="^(?!Public)(.*).html$"/>
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                        <action type="Rewrite" url="/index.php?s={R:1}"/>
                    </rule>
                </rules>
            </rewrite>
            <httpErrors>
                <remove statusCode="404" subStatusCode="-1"/>
                <error statusCode="404" prefixLanguageFilePath="" path="/error/404.php" responseMode="ExecuteURL"/>
            </httpErrors>
        </system.webServer>
    </configuration>
                

    Result of generation

    
            
    last,重寫后的規則,會繼續用重寫后的值去匹配下面的location。
    break,重寫后的規則,不會去匹配下面的location。使用新的規則,直接發起一次http請求了。
    錯誤頁指定conf/nginx.conf設置:error_page 404 500   = /error.html 或 error_page 404 = http://域名;
    
    rewrite '(?!css)(.*).html' /index.php?s=$1 last;
    rewrite '(?!Public)(.*).html' /index.php?s=$1 last;
                
    1) R[=code](force redirect) 強制外部重定向 
    強制在替代字符串加上http://thishost[:thisport]/前綴重定向到外部的URL.如果code不指定,將用缺省的302 HTTP狀態碼。 
    2) F(force URL to be forbidden)禁用URL,返回403HTTP狀態碼。 
    3) G(force URL to be gone) 強制URL為GONE,返回410HTTP狀態碼。 
    4) P(force proxy) 強制使用代理轉發。 
    5) L(last rule) 表明當前規則是最后一條規則,停止分析以后規則的重寫。 
    6) N(next round) 重新從第一條規則開始運行重寫過程。 
    7) C(chained with next rule) 與下一條規則關聯
    8) QSA 繼續傳遞GET參數
    RewriteRule規則表達式的說明:
    . 匹配任何單字符 
    [chars] 匹配字符串:chars 
    [^chars] 不匹配字符串:chars 
    text1|text2 可選擇的字符串:text1或text2 
    ? 匹配0到1個字符 
    * 匹配0到多個字符 
    + 匹配1到多個字符 
    ^ 字符串開始標志 
    $ 字符串結束標志 
    n 轉義符標志
    
    RewriteEngine On
    RewriteRule (?!css)(.*).html$ /index.php?s=$1 [L]
    RewriteRule (?!Public)(.*).html$ /index.php?s=$1 [L]
    ErrorDocument 404 /error/404.php
                
           <?xml version="1.0" encoding="UTF-8"?>
                <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <clear/>
                    <rule name="thinkphp">
                        <match url="^(?!Public)(.*).html$"/>
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false"/>
                        <action type="Rewrite" url="/index.php?s={R:1}"/>
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    
            

    Tool description:

    Input IIS, nginx, Apache, caddy2 pseudo static selection conversion object, can be converted into the corresponding pseudo static rules. Add nginx to caddy2 on July 16, 2020 < / P > < p > Add IIS to Apache error page on September 29, 2018

    Recommendation tool:

    Tool label:

    TransformationDevelopment