Last active
May 1, 2023 01:36
-
-
Save usagizmo/49e6b98c72e38bfb490ae333ddbe802b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Files ~ "^\.(htaccess|htpasswd)$"> | |
deny from all | |
</Files> | |
Options -Indexes | |
AuthUserFile /var/www/html/.htpasswd | |
# AuthGroupFile /dev/null | |
AuthName "Please enter your ID and password" | |
AuthType Basic | |
require valid-user | |
order deny,allow | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /wp/ | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /wp/index.php [L] | |
</IfModule> | |
# END WordPress | |
# Next.js (SSG) | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^news/$ /news.html [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^news/.+$ /news/[slug].html [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^archive/.+$ /archive/[year].html [L] | |
</IfModule> | |
SetEnvIf Referer "^https://usagizmo\.com" ref01 | |
order deny,allow | |
deny from all | |
allow from env=ref01 | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^jp/company/links.html$ https://%{HTTP_HOST}/ja/company/agency/ [L,R=301] | |
RewriteRule ^jp/company/QualityPolicy.html$ https://%{HTTP_HOST}/ja/company/qualitypolicy/ [L,R=301] | |
RewriteRule ^jp/product/$ https://%{HTTP_HOST}/ja/product/brand/ [L,R=301] | |
RewriteRule ^jp/product/new.html$ https://%{HTTP_HOST}/ja/product/ [L,R=301] | |
RewriteRule ^jp(.*?).html$ https://%{HTTP_HOST}/ja$1/ [L,R=301] | |
RewriteRule ^jp(.*?)$ https://%{HTTP_HOST}/ja$1 [L,R=301] | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_URI} !^/en/inquiry/.*$ | |
RewriteCond %{REQUEST_URI} !^/cn/inquiry/.*$ | |
RewriteRule ^en/(.*?)$ http://%{HTTP_HOST}/en/$1 [L,R=302] | |
RewriteRule ^zh/(.*?)$ http://%{HTTP_HOST}/cn/$1 [L,R=302] | |
</IfModule> | |
# maintenance | |
ErrorDocument 503 /maintenance.html | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
#ip is not your ip. Change ip to see maintenance page | |
# RewriteCond %{HTTP:X-Forwarded-For} !^133\.232\.121\.214$ | |
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$ | |
#requests made not to maintenance.html | |
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|js|css) [NC] | |
# RewriteCond %{REQUEST_URI} !^/maintenance\.html$ [NC] | |
RewriteCond %{REQUEST_URI} !^/maintenance\.html$ | |
#rewrite to maintenance.html | |
RewriteRule ^(.*)$ /maintenance.html [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Satisfy any | |
order allow,deny | |
allow from all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install apache2-utils | |
htpasswd -c /var/www/html/.htpasswd USER_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment