Welcome Guest, Not a member yet? Register   Sign In
.htaccess file in apache server config
#1

[eluser]nzmike[/eluser]
I recently read an article that said using .htaccess is a slight performance hit as apache has to look in every directory it goes through for an .htaccess file. So I've been trying to get rid of all my .htaccess files but have found it's not as easy as copying and pasting the code in the config file.

Here's the contents of my current .htaccess file:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !index.php
    RewriteRule (.*)\.php$ index.php/$1
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 index.php
</IfModule>

and this is the block I'm trying to paste it into in my default file in site-available in apache2.

Code:
<Directory /old>
                Order Deny,Allow
                Deny from all
                Allow from 192.168.1
                # trying to paste in here
        </Directory>

It works fine when I use the .htaccess file in the /old directory but as soon as I put the code in the config file it doesn't. Does anyone have any idea why this is?

Mike
#2

[eluser]nzmike[/eluser]
Sorry I'm an idiot...I was trying to deny all traffic outside of my local network and forgot that the local computer will have the ip 127.0.0.1. After adding this in was a matter of changing AllowOverride to None in the root directory and dropping the contents of the .htaccess file into the appropriate directory.




Theme © iAndrew 2016 - Forum software by © MyBB