Welcome Guest | Login

I need help re: .htaccess, rewriting, subdomains and php

Okay, forgive me if this is a bit newbish - my experience is limited to Windows, apart from some minor dabbling on Linux, so this is a little foreign to me.  I've been looking for the past week or so to a solution, and I can't seem to find any.

On my domain, I have two subdomains set up:  blogs.libertytruth.org, which links to a Wordpress installation (several, actually, since we have several bloggers who each have their own blog set up) which I have symlinked to public_html/blogs/blog_name (I have already symlinked public_html to the Rails liberty_truth/public directory), and discussions.libertytruth.org, which is a phpBB forum setup and links to (public_html/discussions).

For the love of me, I cannot figure out how to tell Apache NOT to try and parse these with Rails, but let PHP take over - if I access http://discussions.libertytruth.org, I get the "Rails application failed to start properly" error; it doesn't happen if I append index.php, but I don't want to customize every relative link in both PHP apps to show index.php.

I added the following lines to my .htaccess file in public_html (really liberty_truth/public):

RewriteCond %{REQUEST_URI} /^blogs.*
RewriteRule .* - [L]
RewriteCond %{REQUEST_URI} /^discussions.*
RewriteRule .* - [L]

Which would, I imagine (I admit, I don't really understand the Rewrite stuff in Apache - shame on me, I suppose), tell Apache not to have Rails parse http://www.libertytruth.org/blogs and http://www.libertytruth.org/discussions, respectively.  However, if I go to those URLs I get a Rails 404 error.

I'd really like to use the subdomains in place of the relative link, but I can't seem to get it to work properly - Apache keeps trying to use Rails, and ends up erroring out because obviously Rails isn't going to know how to parse PHP files :)

Can someone please offer some help on how to do this?  As I said I come from a Windows background, so this mucking around with configuration files is a little new to me.  

Also, if I want to host multiple blogs, each with a separate Wordpress installation (say, no more than 10), would I need a separate Rewrite rule for each of them, pointing to their folder (e.g. public_html/blogs/johndoe, public_html/blogs/janesmith, etc.), or is there a "catch-all" rewrite condition?  I don't know much about RegExp (never had to learn it before), but since that's what the RewriteCond thing looks like, the * should be 'wildcard' and force Rails to ignore anything in the public_html/blogs directory and child directories (which would then include the individual bloggers directories).

Again, any help would be greatly appreciated - I certainly plan to brush up on my Apache skills after this :-)

Thanks,

Wayne M.
Co-Founder
LibertyTruth.org

2008-03-02 08:21 AM

Wayne -

I've moved Vhosts for your sites and now they're under /home/username/blogs and /home/username/discussions respectively. Rails no more catched these requests now but if you access your blog site it'll show you the file listing which  is due to missing an index file. For Apache to load a main php page by default, it should be named after index.php. If you don't have an index.php under the document root, you should have  rewrite rules set up accordingly telling which and where's the  main page. BTW discussions site works fine now.

2008-03-02 09:13 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.