Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1101
  • Last Modified:

Turn off mod_rewrite specific folder

Hi

Just a quick question. How can I turn off the mod_rewrite module just for one directory on the web server. e.g.

I want mod_rewrite on /home/thisuser/public_html/ so that it allows sites without trailing slash and stuff. But I do not want mod_rewrite on /home/thisuser/public_html/stats/

How can I do this.

Thanks

spyrit
0
spyrit
Asked:
spyrit
1 Solution
 
periwinkleCommented:
I assume that you are actually talking about using specific rules for certain virtual hosts, not actually just allowing it for some directories within a single virtual host.  Set up a separate virtual host for the directories that you require the rules to be in, and put the mod_rewrite statements there.

0
 
spyritAuthor Commented:
Yes - I have virtual hosts and I have it set up on /home/user/public_html/ but I want the /stats/ folder within the public_html to not have the mod_rewrite
0
 
TomDavidsonCommented:
"RewriteEngine off" can, I believe be used in a directory directive and an .htaccess file as long as it has permission from the AllowOverride
0
 
cptnem0Commented:
I am trying to do the same. How did you do?

Create htaccess file in sub direct with syntax:

<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

?

I tried above, did not work for me.
0
 
TomDavidsonCommented:
It's very possible that apache is not reading your .htaccess file. Try just putting some random characters in and see if it causes a 500 error. If it doesn't then it's most likely that you have an "AllowOverride None" set somewhere up the directory structure; either in .htaccess or somewhere else in apache's configuration as this tells Apache not to allow any changes (so it won't bother to read .htaccess either)
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now