PDA

View Full Version : URL Redirect


RichieBoy67
02-09-2018, 04:39 PM
Hey everyone,

I want to redirect an old url that contains this:
https://###########/showthread.php/#############.html

to

https://###########/showthread.php?t=##############


A simple 301 redirect which is what I would like to use will not work..

Redirect 301 /showthread.php/#############.html https://###########/showthread.php?t=##############


Thanks

I cannot figure out why this redirect isn't working. I will have to use a rewrite rule instead..

Dave
02-09-2018, 05:16 PM
Try this:
RedirectMatch 301 ^showthread.php/(.*).html$ showthread.php?t=$1

This will redirect showthread.php/*.html to showthread.php?t=*

RichieBoy67
02-09-2018, 05:54 PM
Hey Dave, Thanks much my friend!

I actually got that working with the 301 Redirect. I just needed to add another
RewriteEngine On

The next and last issue is to redirect a thread that no longer exists to a new thread.. Like this..

/showthread.php?t=11929 to https://###############/showthread.php?t=220860

301 will not work and the following wouldn't work..

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{QUERY_STRING} (^|&)t=11929($|&)
RewriteRule ^showthread\.php$ https://###########/showthread.php?t=220860&%{QUERY_STRING}