# Vision blury, can't make .htaccess work w/ mod_rewrite



## kutu62 (Feb 4, 2010)

Seriously I got to stop working on this problem.. my eyes hurt and I'm not getting anywhere.. it's so addicting :e

freebsd 8 - all updated ports

Trying to utilize mod_rewrite because I have wordpress installed and want to enable permalinks. This calls for me to create a .htaccess in my webroot for the domain

.htaccess

```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
```

Well I create .htaccess (as I always have) in the web root and use the above code within it however when I navigate to url which is rewritten I get message "The requested URL /go-to-sleep-kutu/ was not found on this server"

So I'm thinking I don't have mod_rewrite but:

```
# locate mod_rewrite.so
/usr/local/libexec/apache22/mod_rewrite.so
```

Then I find apache doc that says "By default, mod_rewrite configuration settings from the main server context are not inherited by virtual hosts. To make the main server settings apply to virtual hosts, you must place the following directives in each <VirtualHost> section:"

I updated my Vhost and restart apache and still the same error message.

Any troubleshooting tips appreciated.. thanks guys!


----------



## DutchDaemon (Feb 4, 2010)

You may have that module, but is Apache actually loading and using it, in other words, does it show up in [cmd=]httpd -M[/cmd]?


----------



## dennylin93 (Feb 4, 2010)

What about the AllowOverride directive? Did you enable .htaccess files?

Since you have access to the main configuration, why not ditch .htaccess and put it in the config file? Performance would be better.

Some modifications are necessary though:

```
<Directory /path/to/www>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteRule . /index.php [L] 
</Directory>
```


----------



## kutu62 (Feb 4, 2010)

DD and Denylin93

rewrite_module is enabled however adding the rewrite condition to httpd.conf worked flawlessly! Thank you for your help!

Also as a side note to who ever finds this thread later in time apache recommends using your main config and not .htaccess for both access control and rewrites as mentioned in apaches .htaccess tutorial. Good call Denylin93


----------

