URL handling – PHP vs Apache Rewrite

后端 未结 4 1266
[愿得一人]
[愿得一人] 2021-01-29 09:15

Currently I let a single PHP script handle all incoming URLs. This PHP script then parses the URL and loads the specific handler for that URL. Like this:

if(URI          


        
4条回答
  •  庸人自扰
    2021-01-29 10:03

    OK, as for efficiency - htaccess version with regexp and php version with single regexp and loading of matching file would be faster than many htaccess rules or many php if - else

    Apart from that, htaccess and php way should be similar in efficiency in that case, probably with little gain with htaccess (eliminating one require in php)

提交回复
热议问题