MyBB Community Forums

Full Version: Help needed on regular expression. Moving from one domain to another on same host.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Everyone,

I have successfully migrated my forums from one domain to another on same host. Now the problem lies with redirecting URLs from one to another.

As an example earlier my URL was xyz.com/forums/welcome-beginners-how-are-you-t-123.html I want to create a RedirectMatch statement that would redirect this URL into abc.com/forums/welcome-beginners-how-are-you-t-123.html [For your information...I got these descriptive URLs by using Spice Fuse SEO plugin]

I tried using this inside the .htaccess file of the old domain (xyz.com/forums)

RedirectMatch permanent ^/([a-z0-9]+) http://mysite.com/forums/$1

but this is not working properly.

Please let me know what do i need to change in the above statement to make it work properly.

Thanks!
I would change the settings in your domain registrar control panel to point the old domain to the new one.
Old domain is still in use , it's just that the forums folder is shifted from the old domain to new domain.
Oh I think this thread should be in the 1.2 series General Support because I am using MyBB 1.2.13 .

My apologies.

Mods could you please transfer this thread there and give the solution too Smile
I'm not up to scratch on my RegEx, but surely that will only allow a-z and 0-9, and your URLs have hyphens in them...?

I don't use this with MyBB, and have never used this in any production environment, but I often use this as a preg_match statement:

/^[a-zA-Z0-9_-]/

Will allow a-z, A-Z, 0-9, _ and -... that should cover everything your URLs have in it...
Thaks Tom.M

I used this finally

RedirectMatch permanent ^/forums/([a-zA-Z0-9_-]+)\.html http://mysite.com/forums/$1.html

Though the redirection is fine now, the only problem left is that after redirection ?tid=number is getting appended to URL.

How can I get rid of this thread id and number after redirection?
I know nothing about RegEx; But I'm guessing you just add a question mark to the RegEx part of the .htaccess file; just a wild guess but you could try it ^_^
(2008-12-12, 10:20 AM)aj30 Wrote: [ -> ]Though the redirection is fine now, the only problem left is that after redirection ?tid=number is getting appended to URL.

How can I get rid of this thread id and number after redirection?

I think this might be a problem with the two boards - does one have SEO URLs turned on and the other have them turned off / not activated...?

It shouldn't be passing it if it is not in the URL ,that's all I can think of...