开发者

apache records in url

I've been seeing this type of url: http://someurl.com?someid=4387&anotherid=1234&yetanother=7365456

And I've seen a modification of that url like this: http://someurl.com/4387/1234/7365456

Also I think I've seen it like this too: http://someurl.com/4387/1234/?开发者_运维知识库yetanother=7365456

What exactly is this called? And is this recognized on the server side? Or in the website scripting?

I'm thinking I want to do this for a project of mine. I am using a url with a few variables after the ? question mark. I'd like to make one of those variables part of the url in that directory format, while the rest can come after the question mark.

I'm running Apache and PHP. I'm gonna guess it has something to do with mod_rewrite, but I'm only guessing. What actually recognizes the variables inside the url like that?


These are generally labelled "friendly URLs".

You would use mod_rewrite to direct the requests to a script (PHP for example). You could either rewrite directly to your script and let PHP examine the request using values in the $_SERVER array

RewriteRule ^.*$ index.php

or capture and set the requested URL as a parameter for the script, eg

RewriteRule ^(.*)$ index.php?req=$1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜