Welcome to WebmasterWorld Guest from 54.145.209.34

Forum Moderators: Ocean10000 & incrediBILL & phranque

This redirect doesn't work ?

   
7:48 pm on Apr 4, 2011 (gmt 0)

10+ Year Member



Can anyone see any reason why the redirects below wouldn't work please ?

RewriteEngine on
Options +FollowSymlinks

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^120\.50\.18\. [OR]
RewriteCond %{REMOTE_ADDR} ^121\.96\.171\. [OR]
RewriteCond %{REMOTE_ADDR} ^217\.196\.17\. [OR]
RewriteCond %{REMOTE_ADDR} ^78\.147\.174\.
RewriteRule /403.php [L,R=301]
7:53 pm on Apr 4, 2011 (gmt 0)

10+ Year Member



I've tested it with my IP address, but it still never takes me to the 403.php page ? ? I'm almost 100% sure I've followed the instructions in these threads.

Any help much appreciated.

Dexie
9:34 pm on Apr 4, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Your RewriteRule is looking for a URL request like
www.example.com/<anything-or-nothing>/403.php
and fails to specify a new URL to redirect to.

Even if your code had worked, it would have sent a 301 response back, and not a 403 response.

Omitting the IP checks (add those back in yourself) the rule should be something like:

RewriteCond %{REQUEST_URI} !/403\.php
RewriteRule .* - [F]


ErrorDocument 403 /403.php
9:20 am on Apr 5, 2011 (gmt 0)

10+ Year Member



Thanks for that, it's appreciated. The request is just to affect unwanted IP's. I still want any good IP's that have just typed in the wrong address to get a 404 and then redirect to the home page after a short message to say that they will be redirected to the home page in a few seconds. Does what you suggest affect that at all please?
7:29 am on Apr 7, 2011 (gmt 0)

10+ Year Member



Anyone ?
7:09 pm on Apr 7, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The 404 ErrorDocument should be served at the originally requested URL, should return a 404 HTTP status, a plain text human readable error message, and optionally some clickable links to related content.

It should not "redirect" anywhere, especially not to the home page.
8:06 pm on Apr 7, 2011 (gmt 0)

10+ Year Member



Thanks for the info. I'm getting a little confused as I feel a little out of my depth here ;-( I know on one of my sites, if a user types a wrong url into the address bar, it takes them to an error page, then after 5 seconds, it refreshes them to the home page.
8:15 pm on Apr 7, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Ah, the refresh is likely using javascript or the meta refresh element. That's generally not a good idea. It can confuse humans a searchengines alike.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month