Forum Moderators: phranque

Message Too Old, No Replies

Redirect all requests directory + possible files to homepage

         

Jim123

10:20 am on Jun 29, 2012 (gmt 0)

10+ Year Member



Really annoying and I'm spending already two hours to find the answer online but I have to give up.

I get lot's of requests like these and I want to redirect them all to the homepage.

http://domain.tld/forum/ucp.php?mode=register&sid=0733d4e208508e9b96801f5c1e4202d7 
and
http://domain.tld/ucp.php?mode=register&sid=0733d4e208508e9b96801f5c1e4202d7 
and
http://domain.tld/viewforum.php?f=3&sid=0733d4e208508e9b96801f5c1e4202d7
and
http://domain.tld/forum/viewforum.php?f=3&sid=0733d4e208508e9b96801f5c1e4202d7


Since there is no forum anymore, I want to redirect the requests.

Basically, the questions are:
- how to redirect any requests to (possible) files in a directory to the homepage and
- how to redirect any file that starts with, let's say view or ucp, to the homepage.

Anyone the solution?

Thanks!
Okoth

g1smd

12:06 pm on Jun 29, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do not redirect these requests to the homepage.

If the content has gone, return "410 Gone" and put useful links to your content on the error page that is displayed.

This has been discussed several times in the last few weeks and many times this year.

Use example.com in this forum.

Jim123

5:50 am on Jun 30, 2012 (gmt 0)

10+ Year Member



Thanks for your reply and sorry you misunderstood my question.

My question was not if it is wise to redirect the requests to the homepage, but HOW to do it. If I understand HOW to redirect dynamics files (that are inside a directory) I can generalise it for many situations.

Thanks
Okoth

lucy24

8:54 am on Jun 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Since there is no forum anymore, I want to redirect the requests.

Add me to the list of people saying "Why do you want to annoy your users?" The redirect-to-home method aggravates me to no end when I meet it in the course of normal browsing. I don't want the home page; if I'd wanted to see it again I would have requested it. Instead, I want the address bar to show me what I typed, so I can see if I misspelled something-- OR so I can notify the webmaster of a bad link. The one thing you will never see on a home page is "If you got here by clicking on a link somewhere in this site..."

Oh. Right. Just tell him how to use the damned gun.

Luckily there's no need to :) There are, at a rough estimate, 3650* earlier threads in this forum asking essentially the same question. In 3649 of them, the answer involves two lines in mod_rewrite. (In no. 3650, the respondent's cat stepped on the Submit key before the post got past "mod_r--".)


* Or was it 520? Someone figured it out once.