snipt

Ctrl+h for KB shortcuts
Notice: Snipt is moving away from free accounts on May 1st, 2014. Read more about the transition here.
#58380

Text only

.htaccess mod_rewrite - how to exclude directory from rewrite rule

1
2
3
4
5
6
7
Try this rule before your other rules:

RewriteRule ^(foldername1|foldername2)($|/) - [L]

This will end the rewriting process.

http://stackoverflow.com/questions/1848500/htaccess-mod-rewrite-how-to-exclude-directory-from-rewrite-rule
https://snipt.net/embed/64144b2f365a5e417582807a3612e918/
https://snipt.net/raw/64144b2f365a5e417582807a3612e918/
64144b2f365a5e417582807a3612e918
text
Text only
7
2014-04-22T18:23:16
True
False
Mar 27, 2013 at 07:58 AM
/api/public/snipt/58380/
htaccess-mod_rewrite-how-to-exclude-directory-from-rewrite-rule
<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>Try this rule before your other rules: </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>RewriteRule ^(foldername1|foldername2)($|/) - [L] </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>This will end the rewriting process. </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>http://stackoverflow.com/questions/1848500/htaccess-mod-rewrite-how-to-exclude-directory-from-rewrite-rule </span></pre></div> </td></tr></table>
.htaccess
#48588

Text only

.htaccess allowing access from one IP only

1
2
3
4
order deny, allow
deny from all
allow from a.b.d.c
# Where a.b.c.d is the allowed IP
https://snipt.net/embed/9d0210f5e69feb4b316ade61882efb03/
https://snipt.net/raw/9d0210f5e69feb4b316ade61882efb03/
9d0210f5e69feb4b316ade61882efb03
text
Text only
4
2014-04-22T19:42:34
True
False
/api/public/snipt/48588/
htaccess-allowing-access-from-one-ip-only
<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>order deny, allow </span><span id="L-2"><a name="L-2"></a>deny from all </span><span id="L-3"><a name="L-3"></a>allow from a.b.d.c </span><span id="L-4"><a name="L-4"></a># Where a.b.c.d is the allowed IP </span></pre></div> </td></tr></table>
.htaccess, server, web
#39909

ApacheConf

Setting PHP Memory Limit in .htaccess

php_value memory_limit 64M
https://snipt.net/embed/30355940c5db855d848c556c6df1cf4b/
https://snipt.net/raw/30355940c5db855d848c556c6df1cf4b/
30355940c5db855d848c556c6df1cf4b
apacheconf
ApacheConf
1
2014-04-18T05:13:14
True
False
/api/public/snipt/39909/
setting-php-memory-limit-in-htaccess
<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 id="L-1"><a name="L-1"></a><span class="nb">php_value</span> memory_limit <span class="m">64</span>M </span></pre></div> </td></tr></table>
.htaccess
#33303

Text only

Rewrite url

1
2
3
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [nc]
https://snipt.net/embed/fcf5bf24f7bc6eff99e83b28f7f96e17/
https://snipt.net/raw/fcf5bf24f7bc6eff99e83b28f7f96e17/
fcf5bf24f7bc6eff99e83b28f7f96e17
text
Text only
3
2014-04-22T17:35:53
True
False
/api/public/snipt/33303/
rewrite-url-1
<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 id="L-1"><a name="L-1"></a>Options +FollowSymlinks </span><span id="L-2"><a name="L-2"></a>RewriteEngine on </span><span id="L-3"><a name="L-3"></a>RewriteRule ^(.*)\.htm$ $1.php [nc] </span></pre></div> </td></tr></table>
.htaccess