Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite

         

MikefromVT

3:02 pm on Aug 5, 2005 (gmt 0)

10+ Year Member



Hello.

I have multiple WWW sites virtually hosted on 1 IP address. The HTTPD is Apache 1.3. My problem is that all of the sites are PHP driven CMSs with long and search engine unfriendly URLs. The CMS offers a short URL solution built around mod_rewrite.

Is it the case that the first .htaccess file will overwrite any and all other .htaccess files as long as all sites are hosted on 1 domain?

I want to have at least 3 different .htaccess files and may have to opt for 3 separate ISP accounts.

Thanks

Mike

jdMorgan

5:03 pm on Aug 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mike,

Welcome to WebmasterWorld!

Lower-level .htaccess files will take precedence over higher-level ones *if* the higher-level ones do not change the URL path in such a way that the lower-level .htaccess file's directory is not accessed, and *if* RewriteOptions inherit is not set. That is, the .htaccess files are processed from the document_root down to the lowest-level subdirectory along the URL-path, and an .htaccess file can only have an effect if it is executed as the server makes its way down the URL-path from the top.

If all of your domains resolve to a single top-level directory, then it is a simple matter of testing %{HTTP_HOST} using RewriteCond to determine which domain was requested by the client, and rewriting accordingly -- for example, rewrite each domain to its own subdirectory of the main 'account'.

Jim

MikefromVT

6:18 pm on Aug 13, 2005 (gmt 0)

10+ Year Member



Thanks, Jim.

I've now gotten this matter straightened out.

Regards

Mike