snipt

Ctrl+h for KB shortcuts

ApacheConf

Przekierowanie z subdomeny www

RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1%{REQUEST_URI} [R=301,L,QSA]
https://snipt.net/embed/b5ece811f78e258fd7c635176e87231e/
https://snipt.net/raw/b5ece811f78e258fd7c635176e87231e/
b5ece811f78e258fd7c635176e87231e
apacheconf
ApacheConf
2
2016-09-26T14:46:57
True
False
False
/api/public/snipt/48138/
przekierowanie-z-subdomeny-www
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nb">RewriteCond</span> %{HTTP_HOST} ^www\.(.*) </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteRule</span> (.*) http://%1%{REQUEST_URI} [R=301,L,QSA] </span></pre></div> </td></tr></table>
Apache, www

Text only

WWW 07.10

1
2
3
4
5
6
7
8
http://elearn.uni-sofia.bg/
www@2011

atanas@fmi.uni-sofia.bg

http://62.44.100.214/~[ime]
~/public_html/*.php
~/webapps
https://snipt.net/embed/1ae349f949ee46d009fd253b7d41d964/
https://snipt.net/raw/1ae349f949ee46d009fd253b7d41d964/
1ae349f949ee46d009fd253b7d41d964
text
Text only
8
2016-09-29T01:20:16
True
False
False
/api/public/snipt/30730/
www-0710
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>http://elearn.uni-sofia.bg/ </span><span id="L-2"><a name="L-2"></a>www@2011 </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>atanas@fmi.uni-sofia.bg </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>http://62.44.100.214/~[ime] </span><span id="L-7"><a name="L-7"></a>~/public_html/*.php </span><span id="L-8"><a name="L-8"></a>~/webapps </span></pre></div> </td></tr></table>
www

Text only

Redirect non-www to www

1
2
3
4
# Redirect all website.com traffic to www.website.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^website\.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [R=301,L]
https://snipt.net/embed/c17b712e6b2f6fee1d8ccba789a4a517/
https://snipt.net/raw/c17b712e6b2f6fee1d8ccba789a4a517/
c17b712e6b2f6fee1d8ccba789a4a517
text
Text only
4
2016-09-26T17:26:34
True
False
False
/api/public/snipt/28079/
redirect-non-www-to-www
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a># Redirect all website.com traffic to www.website.com </span><span id="L-2"><a name="L-2"></a>RewriteEngine On </span><span id="L-3"><a name="L-3"></a>RewriteCond %{HTTP_HOST} ^website\.com$ [NC] </span><span id="L-4"><a name="L-4"></a>RewriteRule ^(.*)$ http://www.website.com/$1 [R=301,L] </span></pre></div> </td></tr></table>
htaccess, non-www, www

Bash

403 Forbidden error apache mac os x

1
2
3
4
5
6
#  To avoid the 403 Forbidden error when browsing sites in your ~/Sites folder
#  add the apache user "_www" to the staff group... 
#  Note: sometimes staff may be admin if you're upgrading from earlier OS X
#
#  Solution for OS X Leopard's dscl tool (Directory Service Command Line)
sudo dscl . -append /Groups/staff GroupMembership "_www"
https://snipt.net/embed/ac7aa37befea77f5f4db863a3c18ec3c/
https://snipt.net/raw/ac7aa37befea77f5f4db863a3c18ec3c/
ac7aa37befea77f5f4db863a3c18ec3c
bash
Bash
6
2016-09-29T02:43:51
True
False
False
/api/public/snipt/3554/
403-forbidden-error-apache-mac-os-x
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># To avoid the 403 Forbidden error when browsing sites in your ~/Sites folder</span> </span><span id="L-2"><a name="L-2"></a><span class="c"># add the apache user &quot;_www&quot; to the staff group... </span> </span><span id="L-3"><a name="L-3"></a><span class="c"># Note: sometimes staff may be admin if you&#39;re upgrading from earlier OS X</span> </span><span id="L-4"><a name="L-4"></a><span class="c">#</span> </span><span id="L-5"><a name="L-5"></a><span class="c"># Solution for OS X Leopard&#39;s dscl tool (Directory Service Command Line)</span> </span><span id="L-6"><a name="L-6"></a>sudo dscl . -append /Groups/staff GroupMembership <span class="s2">&quot;_www&quot;</span> </span></pre></div> </td></tr></table>
"directory service", "mac os x", "user administration", bash, www

ApacheConf

apache .htaccess code to load site with www prefix at all times

1
2
3
4
5
6
7
# this code in your .htaccess file makes sure that the url loads 
# with the 'www.' subdomain in place...
# 
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{http_host} ^yourdomain.com [nc]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,nc,L]
https://snipt.net/embed/8bbfa2939b5478163efabbc0da9ae4fc/
https://snipt.net/raw/8bbfa2939b5478163efabbc0da9ae4fc/
8bbfa2939b5478163efabbc0da9ae4fc
apacheconf
ApacheConf
7
2016-09-29T06:44:10
True
False
False
/api/public/snipt/3171/
apache-htaccess-code-to-load-site-with-www-prefix-at-all-times
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># this code in your .htaccess file makes sure that the url loads </span> </span><span id="L-2"><a name="L-2"></a><span class="c"># with the &#39;www.&#39; subdomain in place...</span> </span><span id="L-3"><a name="L-3"></a><span class="c"># </span> </span><span id="L-4"><a name="L-4"></a><span class="nb">Options</span> +FollowSymLinks </span><span id="L-5"><a name="L-5"></a><span class="nb">RewriteEngine</span> <span class="k">On</span> </span><span id="L-6"><a name="L-6"></a><span class="nb">RewriteCond</span> %{http_host} ^yourdomain.com [nc] </span><span id="L-7"><a name="L-7"></a><span class="nb">RewriteRule</span> ^(.*)$ http://www.yourdomain.com/$1 [R=301,nc,L] </span></pre></div> </td></tr></table>
.htaccess, always, apache, conf, config, htaccess, load, site, subdomain, www
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.