Sign in to follow this  
Followers 0
AStalUK

Help. Apache mod_rewrite

4 posts in this topic

Hi, I'm in the process of setting up my first web server to be used in house partly as a training exercise for myself, but also to host a company forum/wiki.

The server is running CentOS6 using the minimum setup so no GUI. Apache was loaded via yum and is 2.2.15. I've also loaded and have running phpBB along with the required pre-requisites. Later I intend to load MediaWiki (we've been using Screwturn wiki, loaded on a Windows box).

Currently phpBB is access via http://forum.mydomain.com/forum, but I would like to set it up so that you can simply type "forum.woodgate-clark.co.uk" to get to the page. It would seem that I can do this within Apache using the mod_rewrite technique but after having read (and clearly, not understood) the page on the Apache site I still can't get it to work. I've enabled "AllowOverride All" within the httpd.conf file and created a .htaccess file within /var/www/html directory, but I'm struggling after that.

Thanks in advance.

Share this post


Link to post
Share on other sites

You will need to define your virtual hosts within the httpd.conf file.

I cant remember exactly the formating but something like this should work. Append it to the end of the file.

<VirtualHost *>
	DocumentRoot "/var/www/forum/"
	ServerName forum.domain.co.uk
	ServerAdmin webmaster@domain.co.uk
	ErrorLog /var/log/apache2/forum.log

	<Directory /var/www/forum/>
		Options Indexes FollowSymLins MultiViews +Includes
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
</VirtualHost>

Something to that effect should work i believe :)

Edit: Sorry just to add to that, when you add your wiki etc you will need to define a new VirtualHost. So just add another block to the end of the httpd.conf

<VirtualHost *>
	DocumentRoot "/var/www/forum/"
	ServerName forum.domain.co.uk
	ServerAdmin webmaster@domain.co.uk
	ErrorLog /var/log/apache2/forum.log

	<Directory /var/www/forum/>
		Options Indexes FollowSymLins MultiViews +Includes
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
</VirtualHost>

<VirtualHost *>
	DocumentRoot "/var/www/wiki/"
	ServerName wiki.domain.co.uk
	ServerAdmin webmaster@domain.co.uk
	ErrorLog /var/log/apache2/wiki.log

	<Directory /var/www/wiki/>
		Options Indexes FollowSymLins MultiViews +Includes
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
</VirtualHost>

Something like that ;)

Share this post


Link to post
Share on other sites

Sorry for the late reply. This was exactly what I was looking for and works perfectly.

Share this post


Link to post
Share on other sites

You're welcome, and just for anyone else visiting this thread for advice due to my laziness and use of copy/paste, FollowSymLins should in fact be FollowSymLinks.

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.