LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Apache htaccess is doing my nut in (https://www.linuxquestions.org/questions/linux-enterprise-47/apache-htaccess-is-doing-my-nut-in-780711/)

Samael 01-07-2010 06:42 PM

Apache htaccess is doing my nut in
 
I've been struggling with this for ages. Basically on my site I have a wildcard SSL with following subdomain:

forum.domain.com

As usual domain.com goes to a folder such as public_html. I've used the Apache config to direct forum.domain.com to public_html/forum.

It works fine but I want to put an htaccess in public_html/forum that will cause www.domain.com/forum to be rewritten as forum.domain.com

I've found various means of doing this online but they always have something like this:

Code:

RewriteCond %{HTTP_HOST}  !^forum\.domain\.com [NC]
RewriteCond %{HTTP_HOST}  !^$
RewriteRule ^/(.*)        http://forum.domain.com/$1 [L,R]

I can't use this though as I need it to work for both http and https. Any ideas?

fang0654 01-08-2010 07:05 PM

Can you just use virtual hosts?

AKA domain.com points to public_html, whereas the forum area has its own folder, with its own config for forum.domain.com.

Here is a relatively simple tutorial on how to set up virtual hosts:

http://www.debian-administration.org/articles/412

Samael 01-09-2010 12:23 PM

Quote:

Originally Posted by fang0654 (Post 3819619)
Can you just use virtual hosts?

I have done:
"As usual domain.com goes to a folder such as public_html. I've used the Apache config to direct forum.domain.com to public_html/forum."

My post is in regards to the fact that it's still possible to use domain.com/forum/ to view the forum, whereas I only want it viewable by the other method forum.domain.com which will require an htaccess rewrite rule which works from the forums directory onward.


All times are GMT -5. The time now is 12:06 AM.