AMD
AMD

Reputation: 1268

The .htaccess code shoud not affect my forum?

I have a website and let's call it example.com. I also use a htaccess which is long and I am posting a part of it

<filesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=7257600"
</filesMatch>
<filesMatch "\.(js|css|pdf|txt)$">
    Header set Cache-Control "max-age=604800"
</filesMatch>
<filesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=600"
</filesMatch>

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css

How can I make the htaccess which is uploaded in example.com/.htaccess not affect my forum which is located in example.com/forum

I am asking for any code like this

<ifdirectory !"/forum">

//the htaccess code here

</ifdirectrory>

Upvotes: 0

Views: 86

Answers (1)

Dyn
Dyn

Reputation: 395

To allow execution of rewrite rules from parent .htaccess (htaccess from parent folder), you need to explicitly allow it (Apache will treat rewrite rules in current .htaccess as the only one that need to be executed, as long as rewritten URL remains in the same subfolder).

You need to add this line to your .htaccess in sub-folder:

RewriteOptions inherit

Apache manual: http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions

This is a copy of a post found here, no credit to me. Look to your right, in the sidebar, there are plenty of similar topics :)

Upvotes: 3

Related Questions