Redirecting URL's, .htaccess rules.

neosis666
neosis666 used Ask the Experts™
on
Hi there.

I have a problem with an upgrade of our vbulletin forums currently in progress with moving the directory and then re-directing any people who click old links, but not so it will just redirect them to the new site, but the corresponding thread on the new site.

For example.

http://www.example.com/forums/showthread.php?p=123456
would redirect to
http://www.example.com/showthread.php?p=1314739


But as you know, vbulletin has many URL's like this, for example

http://www.example.com/forums/forumdisplay.php?f=10
would also redirect to
http://www.example.com/forumdisplay.php?f=10


So what im asking can I make it so any URL that people attempt to go to at the forums directory will automatically redirect them to the new directory.
So http://www.example.com/forums/ANYTHING|THAT|IS|PUT|HERE
will redirect to
http://www.example.com/ANYTHING|THAT|IS|PUT|HERE


finally, the files and folders in the forums directory will be moved away from this directory, I assume that the htaccess rules will still correct the URL's even though there are no files or folders in the /forums/ directory anymore?


Many thanks

Jon
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
Try something along the following lines, in the root htdocs  .htaccess on your Original site:

RewriteEngine on
RewriteBase /
RewriteRule forums/(.*) $   http://www.newsite.com/$1  [R=301,L]

or if both version are on the same server the following rule may work:

RewriteRule forums/(.*) $   /$1  [R=301,L]



Author

Commented:
Perfect thankyou, though we have gone with another option of leaving the forums in the directory and moving the other feaures of the site away.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial