这是我正在尝试用htaccess做的事情,但找不到我的方式:
$array = array('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd');
function formatting(&$arr, $key) {
global $array;
$array[$key] = ":$arr";
}
array_walk($array, 'formatting');
print_r($array);
答案 0 :(得分:0)
# Force www prefix
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
# Force https prefix on www subdomain
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
# Move non-www to subdomain 'web'
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule !^web/ /web%{REQUEST_URI} [L,NC]
RewriteEngine On