Recent Topics

1 May 25, 2014 07:18    

I have recently migrated someone's blog from another CMS to b2evo. Their URLs look something like this:
http://domain_name.com/?s=pagename&m=permalink&x=post-title

Where 'pagename' is the name given to each individual page and 'post-title' is for the title of each post.

I'm trying to create a .htaccess file to redirect the old URLs to the corresponding pages/posts on b2evo, but am not having much luck. I've used something akin to

<code>Redirect permanent /?s=pagename&m=permalink&x=post-title /blog.php/2012/03/29/</code>

and

<code>RewriteCond %{HTTP_HOST} ^domainname.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domainname.com$
RewriteRule ^\/?s=etc$ "http\:\/\/domainname\.com\/blog\.php\/2007\/07\/02\/post" [R=302,L]</code>

Whatever I do, the URL just redirects me back to the home page, as it would if the post doesn't exist at all. Either that, or I get an error message akin to something not being installed correctly. Is it that the old URLs are constructed in such a way that any attempt to redirect them will throw errors?

I'm on the latest version of b2evo. Don't really know what I'm doing with redirects, and cPanel redirects cause the exact same problems as doing it manually...

Thanks in advance!

2 May 26, 2014 14:32

This a .htaccess limitation - you can't easily use query parameters (anything after a ? in a URL) in a redirect statement.

Someone else might be able to tell you how, or Google will offer various ways to solve this, to be honest I've never really managed to do it, it's always easier to work around it.

3 May 26, 2014 14:41

Thanks. I am browsing websites now looking for answers, but it pretty much goes over my head. What I'm looking at right now though suggests that you could use htaccess to strip out the queries before redirecting? Really wish I knew how it all worked...

The problem is that right now, if you try to load the old URL, it brings you to this message:

"Bad Request! The parameters of your request are invalid. If you have obtained this error by clicking on a link INSIDE of this site, please report the bad link to the administrator. Go back to home page"

which is obviously not good if you're getting there via google search or something.

As it is now, anyone visiting the site via a search will just get errors, even though the site and its corresponding migrated content does exist.

I even tried adding in the query parameters to b2evo URLs in the hopes that I could just match the new with the old... but b2evo doesn't like that either.

:(


Form is loading...