views:

14

answers:

1

Hi,

I am hosing multiple projects on the same local server and was wondering if it was possible to put the rewrite rules for each project in the httpd.conf file rather than in the .htaccess file for each project.

Is the syntax exactly the same in the httpd.conf file to .htaccess because I've never used it before?

Thanks.

A: 

Yes, it is possible:

This module operates on the full URLs (including the path-info part) both in per-server context (httpd.conf) and per-directory context (.htaccess) […]

The main difference between using mod_rewrite in an .htaccess file and in a different context is the syntax of the pattern of RewriteRule:

When using the rewrite engine in .htaccess files the per-directory prefix (which always is the same for a specific directory) is automatically removed for the pattern matching and automatically added after the substitution has been done.

So while the path prefix is removed before and thus must also be removed from the pattern, the full path must be provided when using in any other context.

Gumbo