Possible Duplicate:
How to: URL re-writing in PHP?
网站如何使用您直接在 URL 中提供的参数?
例如,您可以访问:
然后该网站上的脚本可以使用值 www.google.com 来查看该网站是否已启动。
我可以这样做:
http://isup.me/index.php?url=ww.google.com
$url = $_GET['url'];
但这不是很干净,我很想知道它是如何以其他方式完成的。
非常感谢! pimvdb 指出这是这个问题的重复:
最佳答案
您需要ModRewrite。
# Turn on URL rewriting
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [L]
关于php - 如何通过 URL 接受 GET 参数,但不包含 ".php?argument=value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8680907/