1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Manual redirection to 404 error page ?

Discussion in 'Apache' started by Tomaz, Jun 28, 2011.

  1. #1
    Hello.

    I did a quick-look through FAQ section and I didn't find the answer, so - Is it possible (via .htaccess) to manually redirect certain URL to 404 error page?

    I'm having difficulties with one of my websites, which had the aardvark topsites script installed earlier and is now a fresh wordpress content, but some of the old URL's (i.e. http://www.my-domain.com/?a=stats&u=username&all_reviews=1) are still in google and I'd like to redirect all the url's containing "?a=stats...." to be redirected to my 404 page, as my 404 page already is connected with the index page.

    Is it possible to do it, and if so, how?


    Thanks,


    T.
     
    Tomaz, Jun 28, 2011 IP
  2. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do it with a redirect, and make sure your 404 page outputs 404 headers, for the bots (or even 410). If you don't like that, use a redirect to a page that will never exist.
     
    ntomsheck, Jul 6, 2011 IP
  3. pupul

    pupul Prominent Member

    Messages:
    1,737
    Likes Received:
    66
    Best Answers:
    2
    Trophy Points:
    340
    #3
    I code for 400,401,403,404,500 redirection pages.
    PM me if interested
     
    pupul, Jul 6, 2011 IP
  4. MartinPrestovic

    MartinPrestovic Peon

    Messages:
    213
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try something along these lines:

    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^a=stats$
    RewriteRule ^(.*)$ /your-404.html [R=301,L]
    
    Code (markup):
    That will redirect any url that contains a=stats in the query string to your 404 file as a permanent redirect.
     
    MartinPrestovic, Jul 6, 2011 IP
  5. ntomsheck

    ntomsheck Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    However, your 404 page has to output 404 headers, or that will just send out 301 headers, and the bots wont know not to index that.
     
    ntomsheck, Jul 10, 2011 IP