.htaccessスニペットジェネレーター
よく使われる.htaccessのルールを生成します。HTTPSの強制、wwwへのリダイレクト、キャッシュヘッダーの設定、Gzipの有効化など。
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]このツールの使い方
- 1
Open the dropdown and choose the rule you need (for example, Force HTTPS or Gzip compression).
- 2
Read the generated snippet shown in the code box below the dropdown.
- 3
Select the text and copy it, then paste it into your site's .htaccess file.
- 4
Switch the dropdown to a different rule to view another snippet — combine several by pasting them one after another.
.htaccessスニペットジェネレーターとは何ですか?
.htaccessはApacheのディレクトリ単位の設定ファイルです。URLの書き換え、リダイレクト、キャッシュ、圧縮、セキュリティヘッダーを制御します。Hostingerをはじめとするほとんどの共有ホスティングはApache(またはそれと互換性のあるLiteSpeed)を使用しています。これらのスニペットは最もよくあるニーズをカバーしています。
よくある活用例
Forcing every visitor onto HTTPS after installing an SSL certificate on a shared Apache or LiteSpeed host.
Canonicalizing a domain to either the www or non-www version with a 301 redirect to consolidate SEO signals.
Adding a one-year browser cache to static assets so repeat visitors load CSS, JS, and modern image formats from cache.
Turning on Gzip compression for text responses to cut transfer size and improve page load time.
Hiding the contents of a folder that has no index file by disabling Apache's automatic directory listing.
Blocking PHP execution inside a public uploads directory so an attacker can't run a script they managed to upload.
よくある質問
.htaccessはNginxで動作しますか?▼
.htaccessはどこに置けばよいですか?▼
関連ツール
パスワード生成ツール
暗号学的に安全なパスワードをブラウザ内で生成します。サーバーには何も送信されません。ランダムなバイト列はブラウザのcrypto APIから取得されます。
WordPressユーザー名ジェネレーター
安全でランダムなWordPress管理者ユーザー名を生成します。「admin」は決して使わないでください。総当たり攻撃の標的ナンバーワンです。
ドメイン名ジェネレーター
キーワードから、ブランドとしての可能性を秘めたドメイン名のアイデアを生成します。組み合わせには、一般的な接頭辞、接尾辞、修飾語が含まれます。
会社名ジェネレーター
ブランドとして通用する会社名のアイデアを生成します。実在する単語と修飾語を組み合わせて、記憶に残る名前を作り出します。
URLスラッグ生成ツール
テキストをURLに適したスラッグに変換します。小文字に変換し、特殊文字を取り除き、単語をハイフンで区切ります。
Lorem Ipsumジェネレーター
モックアップやデザイン用のダミーテキストを生成します。段落、文、単語から選べます。