954,242 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Subdirectory move and redirect

Hi all, I have a phpbb forum that I had to move to a subdirectory (/forum/). We've been going for 8 years so have a lot of stuff indexed on Google etc.

Is there a painless way of using .htaccess to send all requests to the subdirectory. The root directory will be empty save for the forum subdirectory and its contents.

I have searched various forums, including this one and the Apache site, but am totally out of my depth here - regex kills me!

Any advice would be very welcome.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,775 posts since Oct 2006
Reputation Points: 1,168
Solved Threads: 1,076
 

Hello,

You should be able to simply change the document root in the apache configuration to the new location.

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com/forum
    ServerName dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
rch1231
Posting Shark
959 posts since Sep 2009
Reputation Points: 119
Solved Threads: 142
 

Unfortunately, I'm hosted on a shared server.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,775 posts since Oct 2006
Reputation Points: 1,168
Solved Threads: 1,076
 

Seems I've got to change to document root in the conf file. Pah! Never mind, job for the host.

Thanks rch. Problem solved.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,775 posts since Oct 2006
Reputation Points: 1,168
Solved Threads: 1,076
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: