mod rewrite everything after domain into get

前端 未结 3 1056
情歌与酒
情歌与酒 2021-01-27 12:24

How can I rewrite everything after the domain name into get if it is not already get?

For example : example.com/blah/blah.blah

will become example.com/?blah/blah

3条回答
  •  甜味超标
    2021-01-27 12:56

    Another technique is to use the $_GLOBALS['PATH_INFO'] variable which will give you the rest of the path after the script name, so for:

    http://example.com/somefile.php/james/fred/blogs.csv?something=value
    

    PATH_INFO would be set to "/james/fred/blogs.csv" and you would still have the possibility of using GET/POST variables separately as modifiers. This can be quite useful, for example if you want to create a .csv file and have it appear to the remote browser client as if it were named "blogs.csv".

提交回复
热议问题