This is a follow-up to the issue we were having with htaccess regex rules, redirecting the old URLs to the new ones created with sh404sef.
I've been round-and-round with our hosting company's support trying to get this working, and they told us 'use sh404sef and create manual redirects using the joomla redirect' (which is not practical when you have 3000+ different old urls to redirect). So I'm asking here one more time to see if maybe you can spot the problem or offer some sort of practical solution.
Here's what we have right now in our htaccess file:
Things work fine except when we have an article that starts with an number like
"9 New Year's REsolutions for Cattle Producers" which generates a URL like this:
When that happens the rule automatically removes the "9" from the article alias, resulting in:
I've tried placing a new htaccess rule in advance of the above rule:
or
But the 'generic' (regex) rule seems to always run and remove the leading number from the article name/alias.
I've also tried a regex like this:
to try to isolate the initial article number from the number appearing at the start of the article name, but it doesn't solve the problem either.
I've had several people suggest multiple solutions, but haven't been able to get this to work.
I'm at my end of being able to resolve this.
This isn't rocket-science and should be a rather common need in the world of Joomla (esp. for those migrating from std Joomla SEF to sh404sef URLs).
I just need to redirect old ULRs with article numbers to new ones (with sh404sef) without the article numbers.
Are you able to look at this and see what might solve the problem?
I've been round-and-round with our hosting company's support trying to get this working, and they told us 'use sh404sef and create manual redirects using the joomla redirect' (which is not practical when you have 3000+ different old urls to redirect). So I'm asking here one more time to see if maybe you can spot the problem or offer some sort of practical solution.
Here's what we have right now in our htaccess file:
RewriteRule ^topics\/([-0-9a-zA-Z]+)?\/([0-9]+)(-)([0-9a-z,-]+)? http://xxxx.net/topics/$1/$4 [L,R=301]
Things work fine except when we have an article that starts with an number like
"9 New Year's REsolutions for Cattle Producers" which generates a URL like this:
http://xxxx.net/topics/management/3542-9-new-years-resolutions-for-cattle-producers
When that happens the rule automatically removes the "9" from the article alias, resulting in:
http://xxxx.net/topics/management/new-years-resolutions-for-cattle-producers
I've tried placing a new htaccess rule in advance of the above rule:
Redirect 301 /topics/management/3542-9-new-years-resolutions-for-cattle-producers http://xxxx.net/topics/management/9-new-years-resolutions-for-cattle-producers
or
rewriterule /topics/management/3542-9-new-years-resolutions-for-cattle-producers http://xxxx.net/topics/management/9-new-years-resolutions-for-cattle-producers [r=301,nc,L]
But the 'generic' (regex) rule seems to always run and remove the leading number from the article name/alias.
I've also tried a regex like this:
RewriteRule ^topics\/([-0-9a-zA-Z]+)?\/([0-9]{1,4}?)(-)([0-9,a-z,-]+)? http://xxxx.net/topics/$1/$4 [L,R=301]
to try to isolate the initial article number from the number appearing at the start of the article name, but it doesn't solve the problem either.
I've had several people suggest multiple solutions, but haven't been able to get this to work.
I'm at my end of being able to resolve this.
This isn't rocket-science and should be a rather common need in the world of Joomla (esp. for those migrating from std Joomla SEF to sh404sef URLs).
I just need to redirect old ULRs with article numbers to new ones (with sh404sef) without the article numbers.
Are you able to look at this and see what might solve the problem?