snipt

Ctrl+h for KB shortcuts

ApacheConf

HTACCESS - Redirect All Pages to One

1
2
3
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/tempIndex.html
RewriteRule (.*) /tempIndex.html [R=301]
https://snipt.net/embed/1467137b13c9633ec89e09c94f61b15e/
/raw/1467137b13c9633ec89e09c94f61b15e/
1467137b13c9633ec89e09c94f61b15e
apacheconf
ApacheConf
3
2016-12-31T06:15:00
True
False
False
Nov 27, 2013 at 05:15 PM
/api/public/snipt/28999/
htaccess-redirect-all-pages-to-one
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">RewriteEngine</span> <span class="k">On</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteCond</span> %{REQUEST_URI} !=/tempIndex.html </span><span id="L-3"><a name="L-3"></a><span class="nb">RewriteRule</span> (.*) <span class="sx">/tempIndex.html</span> [R=301] </span></pre></div> </td></tr></table>
htaccess

ApacheConf

HTACCESS - Old Joomla Page Redirect

1
2
3
RewriteCond %{REQUEST_URI} /index\.php
RewriteCond %{QUERY_STRING} option=com_content&view=article&id=46&Itemid=56
RewriteRule ^(.*)$ http://www.domain.com/newpage.html? [L,R=301]
https://snipt.net/embed/f57c05aca969b39bfbb171ef1441ab5a/
/raw/f57c05aca969b39bfbb171ef1441ab5a/
f57c05aca969b39bfbb171ef1441ab5a
apacheconf
ApacheConf
3
2019-07-12T02:12:43
True
False
False
/api/public/snipt/28998/
htaccess-old-joomla-page-redirect
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">RewriteCond</span> %{REQUEST_URI} <span class="sx">/index</span>\.php </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteCond</span> %{QUERY_STRING} option=com_content&amp;view=article&amp;id=46&amp;Itemid=56 </span><span id="L-3"><a name="L-3"></a><span class="nb">RewriteRule</span> ^(.*)$ http://www.domain.com/newpage.html? [L,R=301] </span></pre></div> </td></tr></table>
htaccess, joomla

ApacheConf

HTACCESS - Joomla index.php Fix

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/
RewriteRule ^index\.php(/(.*))?$ /$2 [R=301,L]
https://snipt.net/embed/699d8c0205461632e0d22999e458fb97/
/raw/699d8c0205461632e0d22999e458fb97/
699d8c0205461632e0d22999e458fb97
apacheconf
ApacheConf
2
2019-06-10T19:55:50
True
False
False
Jun 26, 2013 at 03:21 PM
/api/public/snipt/28995/
htaccess-joomla-indexphp-fix
<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></span><span id="L-1"><a name="L-1"></a><span class="nb">RewriteCond</span> %{THE_REQUEST} ^[A-Z]+\ <span class="sx">/index</span>\.php(/[^\ ]*)?\ HTTP/ </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteRule</span> ^index\.php(/(.*))?$ /$2 [R=301,L] </span></pre></div> </td></tr></table>
htaccess, joomla

ApacheConf

HTACCESS - Redirect Path Starting With

RewriteEngine On
RewriteRule ^oldfolder(.*) /newfile.html [R=301,L]
https://snipt.net/embed/bd619c375894daac167136ee736148e4/
/raw/bd619c375894daac167136ee736148e4/
bd619c375894daac167136ee736148e4
apacheconf
ApacheConf
2
2019-06-17T19:55:10
True
False
False
/api/public/snipt/28994/
htaccess-redirect-path-starting-with
<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></span><span id="L-1"><a name="L-1"></a><span class="nb">RewriteEngine</span> <span class="k">On</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteRule</span> ^oldfolder(.*) <span class="sx">/newfile.html</span> [R=301,L] </span></pre></div> </td></tr></table>
htaccess

ApacheConf

HTACCESS - Redirect Old Page to New Page

Redirect 301 /oldpage.html http://www.domain.com/newpage.html
https://snipt.net/embed/85cd3e95815ca143043a020c5ef08ec5/
/raw/85cd3e95815ca143043a020c5ef08ec5/
85cd3e95815ca143043a020c5ef08ec5
apacheconf
ApacheConf
1
2016-12-13T12:01:23
True
False
False
/api/public/snipt/28988/
htaccess-redirect-old-page-to-new-page
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">Redirect</span> <span class="m">301</span> <span class="sx">/oldpage.html</span> http://www.domain.com/newpage.html </span></pre></div> </td></tr></table>
htaccess

ApacheConf

HTACCESS - Full Site Redirect

1
2
3
Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*) http://www.newdomain.com/ [R=301,L]
https://snipt.net/embed/d5410e31ee3ae43402d6335e23b3b249/
/raw/d5410e31ee3ae43402d6335e23b3b249/
d5410e31ee3ae43402d6335e23b3b249
apacheconf
ApacheConf
3
2016-12-29T20:37:58
True
False
False
/api/public/snipt/28984/
htaccess-full-site-redirect
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">Options</span> +FollowSymLinks </span><span id="L-2"><a name="L-2"></a><span class="nb">RewriteEngine</span> <span class="k">On</span> </span><span id="L-3"><a name="L-3"></a><span class="nb">RewriteRule</span> (.*) http://www.newdomain.com/ [R=301,L] </span></pre></div> </td></tr></table>
htaccess

ApacheConf

HTACCESS - Redirect Old Domain to New Domain

1
2
3
4
5
Options +FollowSymLinks

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
RewriteRule .* http://www.newdomain.com%{REQUEST_URI} [R=301,L]
https://snipt.net/embed/f0dc4c3944c969f487ba39dcce4cc515/
/raw/f0dc4c3944c969f487ba39dcce4cc515/
f0dc4c3944c969f487ba39dcce4cc515
apacheconf
ApacheConf
5
2016-12-15T18:23:55
True
False
False
/api/public/snipt/28983/
htaccess-redirect-old-domain-to-new-domain
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nb">Options</span> +FollowSymLinks </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nb">RewriteEngine</span> <span class="k">on</span> </span><span id="L-4"><a name="L-4"></a><span class="nb">RewriteCond</span> %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC] </span><span id="L-5"><a name="L-5"></a><span class="nb">RewriteRule</span> .* http://www.newdomain.com%{REQUEST_URI} [R=301,L] </span></pre></div> </td></tr></table>
htaccess

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/
/raw/c17b712e6b2f6fee1d8ccba789a4a517/
c17b712e6b2f6fee1d8ccba789a4a517
text
Text only
4
2019-07-12T22:37:38
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></span><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