聯系信息

                        網址后面加任意字符都能訪問的錯誤

                        2020-05-19 14:40 By 致遠 1355
                        當前位置: 企業網站建設 > ThinkPHP > 網址后面加任意字符都能訪問的錯誤

                        今個在群里有朋友問到:在html后綴后面,隨便加數字,網頁還可以正常打開,比如http://www.kredytypozyczki.net/mysql/blog-1043.html,在后面加數字或其他內容,如blog-1043.html123,blog-104.htmlxxx,這種是錯誤,為啥不提示錯誤呢?

                        熱心的朋友不少,有的說“自定義一個錯誤吧,正則 檢測 當前域名,html后面有東西,就執行。在中間件判斷一下也可以實現”。也有朋友提到是偽靜態的問題,但沒進一步說明,于是我直接就想到,偽靜態中.html$沒有結束,寫成了.html。測試發現正是偽靜態設置錯誤導致網址后面加任意字符都能訪問的錯誤。

                        順便提一下偽靜態,開始和結束符號都是很重要的,如下一段簡單的代碼:

                        <?xml version="1.0" encoding="UTF-8"?>
                        <configuration>
                            <system.webServer>
                                <httpErrors errorMode="DetailedLocalOnly" />
                                <rewrite>
                                    <rules>
                                        <!--類目-->
                                        <rule name="clas" stopProcessing="true">
                                            <match url="^(.*)/$" />
                                            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                                            <action type="Rewrite" url="index.php/Index/plist/t/{R:1}" />
                                        </rule>
                                        <!--詳情-->
                                        <rule name="pshow" stopProcessing="true">
                                            <match url="^pshow-([\d]+).html$" />
                                            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                                            <action type="Rewrite" url="index.php/Index/pshow/id/{R:1}" />
                                        </rule>
                                        <!--文章-->
                                        <rule name="ashow" stopProcessing="true">
                                            <match url="^ashow-([\d]+).html$" />
                                            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                                            <action type="Rewrite" url="index.php/Index/ashow/id/{R:1}" />
                                        </rule>
                                    </rules>
                                </rewrite>
                            </system.webServer>
                        </configuration>
                        



                        © 致遠 2020-05-19,原創內容,轉載請注明出錯:網址后面加任意字符都能訪問的錯誤

                        留下您的評論

                        > 人人爽人人澡人人高潮_免费无码国产V片在线观看_18禁裸乳无遮挡免费观看_国产99在线 | 欧美_中文字幕无码无码专区 99久久婷婷国产一区二区 玩丰满少妇XXXXXⅩ性麻 精品国产乱码久久久久久久小说 永久免费AV无码网站国产APP 在人线AV无码免费高潮喷水 影音先锋无码A∨男人资源站 亚洲综合激情另类专区 18禁全彩肉肉无遮挡 国产 精品 自在自线 吃奶呻吟打开双腿做受在线视频