htaccess redirect help please

cwe

Well-known member
I've recently migrated one of my vB 3.8 forums to XF. The XF site went live today. Unfortunately, I've got a small problem that I only noticed now after the site went live.

I had several pages on my old vB site which I need to redirect to the new URLs on the XF site. The old URLs were all of the form:

Code:
https://www.mydomain.com/index.php?p=pageidentifier

I need to redirect them to:

Code:
https://www.mydomain.com/pages/pageidentifier/

I added the following two lines to my XF .htaccess file:

Code:
RewriteCond %{QUERY_STRING} p=([-a-zA-Z0-9_+]+)
RewriteRule ^/?index\.php$ /pages/%1/? [R=301,L]

The redirects work. URLs to the old custom pages are resolving to their new equivalents. However, something about this rule breaks the little pop-up that you get when you hover the mouse over a member's username. If I comment out those two lines, the pop-ups work again.

Are there any .htacces / mod rewrite gurus here that can help me with a different rule to effect the rewrite that doesn't break the member info pop-up?

I only know enough mod rewrite stuff to get into trouble. If there isn't a way to handle the redirects elegantly (with pattern matching), how would I hard code redirects for each specific page?
 
Never mind, I figured out I could replace the first line like so:

Code:
    RewriteCond %{QUERY_STRING} p=(news|page\-two|another\-page|etc)

and it works. I also added the page identifiers used in that line to the "Disallowed text in user names" name validation section in the ACP.

Everything seems to be working now.
 
Back
Top Bottom