Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Wanted: Service any htaccess wizzes out there?

Status
Not open for further replies.
Joined
Dec 15, 2005
Posts
1,780
Reaction score
66
Been looking for a solution to this but can find anything that specifically deals with this problem:

I have just rebuilt a site in Wordpress for a client, I have set up a bunch of 301's in htaccess from old site to new, but any old url with a number in it doesn't work, all the ones without numbers are fine.

example:

/index.php/news/15/rhs redirected to http://www.domain.com/news/rhs/

the folder/number /15/ stays in the redirected URl so it ends up:

http://www.domain.com/news/15/rhs/

Anyone know how to get around this?

current mod re-write

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thanks
 
What do your other rewrite rules look like?

Feel free to PM with the real URLs if you'd rather keep them quiet - though it'd be nice to post an anonymised summary of the problem in the thread once sorted!
 
Well you need to remove the second segment (the number) from the path using a RewriteRule like this (not tested but it should be right..):

Code:
RewriteRule ^(.*?)/?([0-9]+)(.*)$ /$1$2
 
Thanks for the help Dave, but in the end it was a browser issue and nothing to do with the redirect.

There was one redirect where the destination URL was wrong, so it was not getting completed properly, it sounds a bit bizarre, but it seems like Firefox had cached this folder structure, and whenever I tried a URL with the same amount of directories with a number folder it processed it the same way as the broken one.

I cleared the cache several times, so don't know how it stored this error.

I tried all the redirects in Chrome (something I probably should have done first before spending 3 hours looking for a solution on Stack Overflow) and they all worked fine, so this is the only explanation I have?
 
Status
Not open for further replies.

Rule #1: Be Respectful

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Systreg AcornBot:
    Systreg has left the room.
      Systreg AcornBot: Systreg has left the room.
      Top Bottom