我正在尝试获取网址的两个不同部分并在重写中使用它们但我无法让它工作
我想要
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0
SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed else
where. [C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\node_m
odules\engine.io\node_modules\ws\node_modules\utf-8-validate\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269
:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules\socket.io\nod
e_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
> bufferutil@1.2.1 install C:\Users\stavalfi\AppData\Roaming\npm\node_modules\lite-server\node_modules\browser-sync\node_modules
\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild
重写为
http://example.com/account/test-page?h=1&t=2
http://example.com/account/test-page
我尝试了十几种不同的方式 - 这是最新的方式:
http://example.com/page.php?path=account/test-page&h=1&t=2
http://example.com/page.php?path=account/test-page
但它不起作用,我正在撕扯我的头发!!
有人可以告诉我,我搞砸了吗?答案 0 :(得分:1)
请改用以下规则:
RewriteRule ^(.*)$ /page.php?path=$1 [QSA,L]
此处的密钥是QSA
flag,它附加在用于已传递给page.php
的查询字符串的查询字符串中。
要明确的是,对/account/test-page?h=1&t=2
的请求将在内部重写为/page.php?path=account/test-page&h=1&t=2
。