pfulton
pfulton

Reputation: 21

htaccess Redirect from subdomain to domain

I'm re-working a site and I'm attempting to move a forum from a subdomain (board.example.com) to the primary domain where the path will be example.com/index.php/forums/

I've set up my htaccess file like so:

RewriteEngine On  
RewriteCond %{HTTP_HOST} ^(.*).example.com  
RewriteRule ^(.*)$ http://www.example.com/index.php/forums/ [R=301,L]

which works, but for all of the content that's already been indexed by search engines, the new URLs show up with old references, like

example.com/index.php/forums/?p=1199&sid=4daeb5acf7983a0f8d56737c4812f474

Is there any way to clear up the bit that's getting appended to the end of the new URL?

Upvotes: 2

Views: 1285

Answers (1)

timdev
timdev

Reputation: 62894

I'm not sure where your sid parameter is coming from...

The way I would probably try first (before resorting to mod_rewrite) would be:

<VirtualHost *>
  ServerName board.example.com
  Redirect permanent / http://www.example.com/index.php/forums/
</VirtualHost>

Upvotes: 1

Related Questions