没有GET的PHP URL(?function =)[重复]

This question already has an answer here:

I would like to know how to make a PhP url without the GET (?function=) part.

Such as:

main/function/42456457654

main being the main page, function being the page with the URL, and 42456457654 being a part selected from a database.

I know you could do this by doing main/function/?function=42456457654, but I'd like to make it so that it still communicates with the server to get values in a database at request.

</div>

You need to put in rewrite rules in your web server's configuration.

Apache:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Nginx

http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

But basically it will rewrite the url from:

main/function/42456457654

to something like

main.php?action=function&id=42456457654

Or something like that

Hope that helps