2014-07-17 29 views
0

在wordpress中,我已將永久鏈接設置設置爲「發佈名稱」。所以定製的結構是:http://example.com/%postname%/設置404如果URL結束數字

當我去我的測試頁面(http://example.com/test/)它返回一個200狀態代碼,這是很好的。但是,當我去http://example.com/test/1234它也返回一個200.當頁面以數字結尾時,如何顯示404頁(和404結果代碼)?

+0

這可能是有益的。看看** http://stackoverflow.com/questions/16179138/wordpress-url-end-with-a-number** –

回答

0

你只需要拿到$ _GET值

<?php 
    if(is_int($_GET['your_var'])){ 
     header("HTTP/1.0 404 Not Found"); 
    } 
?>