我正在使用Godaddy作为其管理面板中的主机,我具有如下所示的.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /core.php [L]
</IfModule>
我进行了如下设置以将其强制为https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%(HTTP-HOST)%{Request-URI} [L,R=301]
</IfModule>
任何人都可以告诉我将core.php放在哪里。我的core.php如下所示
<?php
error_reporting( E_ALL );
require_once( "ccioo/Template/class.Page.php" );
header( "Content-Type: text/html; charset=utf-8" );
if ( function_exists( "date_default_timezone_set" ) ) {
date_default_timezone_set( "Asia/Taipei" );
}
$myPage = new Page();
$myPage->Output();
?>
更新:
所以我要输入的是www.myfavouriteweb.com或https://www.myfavouriteweb.com,它应该重定向到https://www.myfavouriteweb.com
答案 0 :(得分:0)
您可以从Apache使用string authority = "https://login.microsoftonline.com/42b03d0b-d7f2-403e-b764-0dbdcf0505f6/";
string[] scopes = new string[] { "user.read" };
PublicClientApplication app = new PublicClientApplication("ee13c922-bf4b-4f0a-ba39-ea74e1203c6e", authority);
var accounts = await app.GetAccountsAsync();
Microsoft.Identity.Client.AuthenticationResult result = null;
if (accounts.Any())
{
result = await app.AcquireTokenSilentAsync(scopes, accounts.FirstOrDefault());
}
else
{
try
{
var securePassword = new SecureString();
foreach (char c in "PASSWORD") // you should fetch the password keystroke
securePassword.AppendChar(c); // by keystroke
result = await app.AcquireTokenByUsernamePasswordAsync(scopes, "AUSER@acosta.com",
securePassword);
}
}
DirectoryIndex
在这种情况下,如果您需要原始请求,则可以在DirectoryIndex = core.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%(HTTP-HOST)%{Request-URI} [L,R=301]
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ?original_request=$1 [QSA,L]
中使用$_GET["original_request"]
例如
core.php
然后在您的core.php中
https://your_site.com/something
在此示例中,<?php
if(isset($_GET["original_request"])){
//here your code
echo $_GET["original_request"];
}else{
//if acces directly to https://your_site.com (without 'something')
echo "direct acces";
}
?>
在您的服务器中实际上不存在……它在something
中处理