htaccess redirect for wrong link

Hi experts,

I need some help with a redirection in my htaccess. Due to a error in my system I have lots of broken links which I would like to catch for now and redirect to the correct place until the actual problem is solved.

I would like to have in my .htaccess a simples redirect which does the following thing:

The wrong link:

should redirect to:

with other words I need to cut the away from the link if the part is double like in the example above.

Except the sid=0000000000 the url is always the same.

Thank you for your help,
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Oliver2000Connect With a Mentor Author Commented:
Hi again,

I did find a better solution and was be able to fix the wrong link from before. Like this I don't need this redirect anymore. thank you for your help.
RewriteRule ^phpbb/.*(phpbb/.*)$ $1
Oliver2000Author Commented:
Hi parparov,

Dosent this redirect all kind of other stuff as well like this?
I am not sure if you understand me correct or if I wrote it a little bit missunderstanding.

if you take a look at the wrong url: you see that the system somehow writes the part before the second httpd:// wrong. And in this case I need to cut everything before the second httpd:// away.

out of


but I do not want in ANY OTHER case forward except if there is something in the url before the http://
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Oliver2000Author Commented:
I am not sure but your help ^phpbb/.*(phpbb/.*)$ $1 would end up forwarding also to /phpbb/ or am I wrong?
No, this line should have two phpbb to redirect. It actually weeds
from any URL
Oliver2000Author Commented:
hmmm okay let me try....
Oliver2000Author Commented:
Does not work at all. I placed RewriteRule ^phpbb/.*(phpbb/.*)$ $1  in my .htaccess (root) but when I post the wrong url in my browser continue the file not found like before.

(My .htaccess contains already several other redirects so I know the .htaccess redir is acctually working fine)

any idea?
Hmm... works for me.
What version of Apache are you using?

Maybe put the rule on top of your .htaccess file and add some more definitions before and at the end of it?
RewriteBase /
RewriteRule ^phpbb/.*(phpbb/.*)$ $1 [R,L]

Open in new window

Oliver2000Author Commented:
Fixed it myself!
All Courses

From novice to tech pro — start learning today.