snipt

Ctrl+h for KB shortcuts

Bash

Common .htaccess rules

# Google Apps redirect
Redirect 301 /mail http://mail.google.com/a/domain.com

# File execution order
DirectoryIndex index.php index.html

# Added to prevent directory browsing
Options -Indexes

# Redirect primary cPanel "domain.com" to a subfolder with same name: /domain.com/
RewriteEngine on
RewriteCond %{HTTP_HOST}  ^(www\.)?domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/domain.com/
RewriteRule ^/?(.*)$  /domain.com/$1 [L]
https://snipt.net/embed/31efccb94e26f8ffd0def97c1791d790/
/raw/31efccb94e26f8ffd0def97c1791d790/
31efccb94e26f8ffd0def97c1791d790
bash
Bash
14
2019-07-16T20:16:28
True
False
False
/api/public/snipt/9211/
common-htaccess-rules
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a> <a href="#L-12">12</a> <a href="#L-13">13</a> <a href="#L-14">14</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Google Apps redirect</span> </span><span id="L-2"><a name="L-2"></a>Redirect <span class="m">301</span> /mail http://mail.google.com/a/domain.com </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># File execution order</span> </span><span id="L-5"><a name="L-5"></a>DirectoryIndex index.php index.html </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="c1"># Added to prevent directory browsing</span> </span><span id="L-8"><a name="L-8"></a>Options -Indexes </span><span id="L-9"><a name="L-9"></a> </span><span id="L-10"><a name="L-10"></a><span class="c1"># Redirect primary cPanel &quot;domain.com&quot; to a subfolder with same name: /domain.com/</span> </span><span id="L-11"><a name="L-11"></a>RewriteEngine on </span><span id="L-12"><a name="L-12"></a>RewriteCond %<span class="o">{</span>HTTP_HOST<span class="o">}</span> ^<span class="o">(</span>www<span class="se">\.</span><span class="o">)</span>?domain.com$ <span class="o">[</span>NC<span class="o">]</span> </span><span id="L-13"><a name="L-13"></a>RewriteCond %<span class="o">{</span>REQUEST_URI<span class="o">}</span> !^/domain.com/ </span><span id="L-14"><a name="L-14"></a>RewriteRule ^/?<span class="o">(</span>.*<span class="o">)</span>$ /domain.com/<span class="nv">$1</span> <span class="o">[</span>L<span class="o">]</span> </span></pre></div> </td></tr></table>
htaccess