我有以下重写规则:
RewriteEngine On
RewriteRule ^test test.php [NC,L]
这允许我通过以下方式访问该页面:
http://www.example.com/test
和http://www.example.com/test.php
但是如何阻止http://www.example.com/test.php
被访问?
由于
答案 0 :(得分:0)
如果您想直接访问QString QAzureStorageRestApi::generateAutorizationHeader(const QString& httpVerb, const QString& container,
const QString& blobName, const QString& currentDateTime,
const long& contentLength, const QStringList additionnalCanonicalHeaders,
const QStringList additionnalCanonicalRessources)
{
// Create canonicalized header
QString canonicalizedHeaders;
for (const QString& additionnalCanonicalHeader : additionnalCanonicalHeaders)
{
canonicalizedHeaders.append(additionnalCanonicalHeader+"\n");
}
canonicalizedHeaders.append(QString("x-ms-date:%1\nx-ms-version:%2").arg(currentDateTime, m_version));
// Create canonicalized ressource
QString canonicalizedResource;
if (blobName.isEmpty())
{
canonicalizedResource = QString("/%1/%2").arg(m_accountName, container);
}
else
{
canonicalizedResource = QString("/%1/%2/%3").arg(m_accountName, container, blobName);
}
for (const QString& additionnalCanonicalRessource : additionnalCanonicalRessources)
{
canonicalizedResource.append("\n"+additionnalCanonicalRessource);
}
// Create signature
QString signature = generateHeader(httpVerb, "", "", QString::number(contentLength), "", "", "", "",
"", "", "", "", canonicalizedHeaders, canonicalizedResource);
// Create authorization header
QByteArray authorizationHeader = QMessageAuthenticationCode::hash(
QByteArray(signature.toUtf8()),
QByteArray(QByteArray::fromBase64(m_accountKey.toStdString().c_str())),
QCryptographicHash::Sha256);
authorizationHeader = authorizationHeader.toBase64();
return QString("SharedKey %1:%2").arg(m_accountName, QString(authorizationHeader));
}
uri时显示403 forbidden error
页面,则可以使用此规则:
/test.php
如果您想将RewriteCond %{THE_REQUEST} /test\.php [NC]
RewriteRule ^test\.php$ - [R=403,L]
重定向到新的uri /test.php
,请使用以下内容:
/test