我想从我的域名重定向到自定义索引页面并使用此重写规则
var aVals = [{
a: 1
}, {
a: 2
}, {
a: 3
}];
var bVals = [{
b: 4
}, {
b: 5
}, {
b: 6
}, {
b: 7
}];
const mergeArrays = (obj1, obj2) => {
if (obj1.length > obj2.length) {
[obj1, obj2] = [obj2, obj1];
}
const output = obj1.map((value, index) => {
return {
...value,
...obj2[index]
};
});
return output.concat(obj2.slice(obj1.length, obj2.length));
}
console.log(mergeArrays(aVals, bVals));
唯一的问题是我使用Cloudflare总是使用https来解释为什么它首先重定向
# HTID:1827272: DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES BELOW
php_flag display_errors off
php_flag log_errors off
# DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES ABOVE HTID:1827272:
IndexIgnore *
Options -Indexes
#Alternate default index pages
ErrorDocument 404 /error/theme/404.html
ErrorDocument 500 /error500.php
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 4 month"
# CSS
ExpiresByType text/css "access plus 5 month"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/ld+json "access plus 0 seconds"
ExpiresByType application/schema+json "access plus 0 seconds"
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
# Favicon (cannot be renamed!) and cursor images
ExpiresByType image/vnd.microsoft.icon "access plus 1 month"
ExpiresByType image/x-icon "access plus 5 year"
# HTML
ExpiresByType text/html "access plus 0 seconds"
# JavaScript
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"
# Manifest files
ExpiresByType application/manifest+json "access plus 1 week"
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
# Media files
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/bmp "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
# Web fonts
# Embedded OpenType (EOT)
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType font/eot "access plus 1 year"
# OpenType
ExpiresByType font/opentype "access plus 1 year"
# TrueType
ExpiresByType application/x-font-ttf "access plus 1 year"
# Web Open Font Format (WOFF) 1.0
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
# Web Open Font Format (WOFF) 2.0
ExpiresByType application/font-woff2 "access plus 1 year"
# Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
AddType application/x-httpd-php .xml
</IfModule>
# to prevent ifame the code bellow
<IfModule mod_headers.c>
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^gamehup.000webhostapp.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.gamehup.000webhostapp.com [NC]
RewriteRule ^(.*)$ https://gamehup.com/browser-games/index [L,R=301,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteBase /
#only for the root directory
RewriteCond %{REQUEST_URI} ^/$
#if the uri is not already index.php
RewriteCond %{REQUEST_URI} !^/browser-games/index [NC]
RewriteRule ^$ /browser-games/index [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.gamehup\.com [NC]
RewriteRule ^(.*)$ https://gamehup.com/browser-games/index [R=301,NC,L]
那么重定向,怎么才能让它只有一个呢?
http://gamehup.com to https://gamehup.com then to http://gamehup.com/browser-games/index then to https://gamehup.com/browser-games/index
这是我正在使用的所有htaccess代码。