activate apache mod_rewrite
Michael Powell
nightrecon at verizon.net
Mon Jul 13 01:46:16 UTC 2009
Ray wrote:
> On July 12, 2009 05:58:07 pm Gregory T Helton wrote:
>> On Sun, 12 Jul 2009 17:09:24 -0600
>>
>> Ray <ray at stilltech.net> wrote:
>> > Hello,
>> > I'm running FreeBSD 7.0-RELEASE-p3, amd64
>> > I have never used mod rewrite before, but I am about to be hosting a
>> > php website that does use it and I can't figure out how to turn it on.
>> > The website was working properly under other hosting.
>> >
>> > The server has been working properly for over a year with other php
>> > websites. I installed apache 2.2 along with php 5.2 from ports.
>> >
>> > google says that the following lines should appear in httpd.conf
>> >
>> > LoadModule rewrite_module libexec/apache/mod_rewrite.so
[snip]
>>
>> Try with just the LoadModule line. This is the only line I have for
>> mod_rewrite in my httpd.conf, and it is working properly.
>>
>> iirc, the "AddModule" linux is apache 1.x specific.
[snip]
>
> Thanks for the response.
> The loadmodule line is already there.
> Is there anything in the httpd-vhosts.conf or anywhere else needed to
> activate rewrites?
> thanks,
> Ray
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
Various ways of utilizing it as it is very flexible, depending on your
particular requirements. It usually involves at least a RewriteEngine On
directive somewhere. Some can use it in an .htaccess but those who are
running multiple vhosts may need something like this for each vhost:
RewriteEngine On
RewriteOptions Inherit
See the section in the docs. Usually there are two other directives used to
configure functionality after activating it. You will usually have one, or
more, RewriteCond conditions which when evaluated run through a RewriteRule
of some kind. Brush up on your Apache regex handling! There are cheat sheets
around the web, easily Googled up.
mod_rewrite is not easy and can have you pulling your hair out. If you are
using a software that requires it the docs should have a cut and paste
config that can get you started. Trying to figure it out from scratch
without knowing what is needed will be next to impossible.
-Mike
More information about the freebsd-questions
mailing list