Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

htaccess redirect for wrong link

Posted on 2011-09-13
9
295 Views
Last Modified: 2012-05-12
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:
http://www.domain.com/phpbb/http://www.domain.com/phpbb/index.html?sid=90dee20dfdcf5fdacdedc97467949f86

should redirect to:
http://www.domain.com/phpbb/index.html?sid=90dee20dfdcf5fdacdedc97467949f86

with other words I need to cut the http://www.domain.com/phpbb/ 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,
Oliver
0
Comment
Question by:Oliver2000
  • 6
  • 3
9 Comments
 
LVL 9

Expert Comment

by:parparov
ID: 36530881
RewriteRule ^phpbb/.*(phpbb/.*)$ $1
0
 

Author Comment

by:Oliver2000
ID: 36530931
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: http://www.domain.com/phpbb/http://www.domain.com/phpbb/index.html?sid=90dee20dfdcf5fdacdedc97467949f86 you see that the system somehow writes the part http://www.domain.com/ before the second httpd:// wrong. And in this case I need to cut everything before the second httpd:// away.

out of

http://www.domain.com/phpbb/http://www.domain.com/phpbb/index.html?sid=90dee20dfdcf5fdacdedc97467949f86

make
http://www.domain.com/phpbb/index.html?sid=90dee20dfdcf5fdacdedc97467949f86

but I do not want in ANY OTHER case forward except if there is something in the url before the http://
0
 

Author Comment

by:Oliver2000
ID: 36531224
I am not sure but your help ^phpbb/.*(phpbb/.*)$ $1 would end up forwarding also

http://www.domain.com/phpbb/ to /phpbb/ or am I wrong?
0
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
LVL 9

Expert Comment

by:parparov
ID: 36531330
No, this line should have two phpbb to redirect. It actually weeds
/phpbb/http://www.domain.com
from any URL
0
 

Author Comment

by:Oliver2000
ID: 36531493
hmmm okay let me try....
0
 

Author Comment

by:Oliver2000
ID: 36531549
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?
0
 
LVL 9

Expert Comment

by:parparov
ID: 36540203
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

0
 

Accepted Solution

by:
Oliver2000 earned 0 total points
ID: 36545433
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.
0
 

Author Closing Comment

by:Oliver2000
ID: 36565500
Fixed it myself!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question