I’m trying to redirect my /forum/ page and all subsequent forum posts (e.g. /forum/topic/3335/) to myhomepage.com.
I’ve tried all the possible ways I’ve seen on SO but none of them will do it and completely strip the query string.
What is the best way to 301 all of these posts to my home page, and completely strip the query string (including the trailing ? that I don’t want).
Thanks!
Edit:
redirectMatch 301 ^/forum/ http://www.newsite.com/?
This redirected them all to my homepage, but kept the ?, which I don’t want.
RewriteEngine on RewriteRule ^/forum/(.*) http://www.newsite.com/? [L,R=301]
This just didn’t work at all. It didn’t redirect anything.
A quick way would be
RedirectMatch:Note: If forum is under myhomepage.com you don’t need to use the full domain, you could just use
/.UPDATE
To remove the query string, you’ll need to use mod_rewrite: