Redirect support

I have a site setup for a friend where I was using TCMS blog to show a list of inventory for two sets of products. So their site was: and

They’ve now downsized to just sell the one so I’ve removed productB and updated the navigation to:

I think I can work out how to redirect the main url but I’m not entirely sure how to make sure that existing posts get redirected. (Example, if a post is:
how to make sure it goes to

Is there a single rule I can put in or would I need to manually redirect all existing posts?

They only had about 20 active listings so I went and just manually redirected them. Would still be curious for the future if there’s a simple/single htaccess rule that would accomplish the above.

It should be easy enough to do with a simple RewriteRule set.
Since you are giving very generic URL examples I can’t say for sure if this would work but something like this would be a starting point:

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/inventory/productA/details
RewriteCond %{QUERY_STRING} ^permalink=url
RewriteRule ^(.*)$ [R=301,L]
1 Like

I don’t know why I’m being cagey with the details.

The site is and it once had a spot for /inventory/boats and /inventory/trailers. Now it’s just boats.
A sample blog post would be: and the new one would be:

OK so if I understand, The entire trailers section is gone? you are merging the post from /inventory/trailers/details and /inventory/boats/details into /boats/details/?

If that’s true than this should work:

RewriteCond %{REQUEST_URI}  ^(\/inventory/boats|\/inventory/trailers)
RewriteCond %{QUERY_STRING} ^permalink=
RewriteRule ^(.*)$ [R=301,L]

right now the “made with Love htaccess tester” is down so I haven’t been able to test it.

To explain the first rewrite condition
RewriteCond %{REQUEST_URI} ^(\/inventory/boats|\/inventory/trailers)
Simple checks the server variable REQUEST_URI ( after domain name) starts with \/inventory/boats or \/inventory/trailers, if that’s true it goes to the second rewrite condition:
RewriteCond %{QUERY_STRING} ^permalink=
This one checks to see if there is a query string (stuff after ? in the URL) and that it starts with permalink=. If that is true as well then the RewriteRule is applied:
RewriteRule ^(.*)$ [R=301,L]
The %1 should apply the query string as entered.

Right now the only decent tester I know about(link above) is getting a 525 error.


That name looks familiar !

I was just about to post an excellent link to the RW forum where one helpful Teefers walked me through a similar question :-)

He’s a legend!

Only in my own mind…
The tester is back up and working.
I made a couple quick changes and tested with the one sample above:

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^(/inventory/boats|/inventory/trailers)
RewriteCond %{QUERY_STRING} ^permalink=
RewriteRule ^(.*)$ %1 [R=301,L]

I remove an unneeded escape \ char and put a space between the last / and the variable %1. It now should work fine.