Welcome to WebmasterWorld Guest from 50.19.34.234

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Excluding IP on .htaccess

     

Quarfelburg

3:29 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



I have a .htaccess solution that redirects Canadian users to a different site. Unfortunately I am Canadian, and cannot view the site without constantly deleting and then reuploading the .htaccess file.

How do I exclude my IP? And also since I do not have a dedicated IP, would it make sense to get one of those dyndns pointers?

Thanks,
Hayden

carfac

4:11 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi:

Even if you do not have a static IP, you shouldhave a RANGE of IP's you could come from. Could you njust exclude that range?

Another solution (which is just about as poor as the one oyu are using) is to just rename .htaccess every time you access... yeah, i know, not much of a solution.... but it saves some uploading...

dave

Quarfelburg

4:35 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



My ISP is a very common one in Canada, therefore excluding a range would be quite problematic.

My question is for the actual coding, as I am very new to .htaccess

I imagine it is something like:

RewriteCond %{REMOTE_ADDR} ^123\.45\.67\.8$

But I'm not sure.

Also would it be possible to do this using dyndns, or should I pay for the static ip?

jdMorgan

5:04 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Quarfelburg,

Add a condition to your canadian-visitor redirection rule that excludes you IP address or IP address range.

RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.8$
RewriteCond <existing canadian visitor detection>
RewriteRule <existing canadian redirect>

The first line will prevent the redirect of the request comes from your IP address or your IP address block, depending on how you define it.

Another idea: You could create a special subdomain for your own use, supported by transparent redirects, and use those subdomains for viewing your site from the canadian and non-canadian perspectives. Something like [webmaster.yourdomain.com...]

HTH,
Jim

Quarfelburg

5:40 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



That JD, it works, however I am on a dynamic IP behind a router, so hopefully my ip wont change too often.

As per my original question, is it possible to use dyndns in the .htaccess?

For example, could I then exclude "somename.dyndns.org"?

jdMorgan

7:20 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hmmm.. Not sure - I've never done it myself.

If you want to try it, use


RewriteCond %{REMOTE_HOST} !^somename\.dyndns\.org

Instead of the RewriteCond I posted above. It'll either work, or it won't... ;)

It should not affect your regular traffic while testing, though. The worst that can happen (assuming no typos or other .htaccess errors) is that you'll get redirected to the .ca pages.

Jim

Quarfelburg

8:36 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



Well that didn't work, how unfortunate. How do I specify an ip range instead of just an ip?

Thanks,
Hayden

nativenewyorker

11:08 pm on Apr 14, 2003 (gmt 0)

10+ Year Member



Quarfelburg:

Instead of playing with .htaccess, why not just browse your site through a proxy server using a non Canadian IP address?

Ted

jdMorgan

12:30 am on Apr 15, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hayden,

The easiest way is to simply leave off the last digit groups. If you want a pattern to match your desired IP address range exactly, stickymail me the IP range.

Jim

Quarfelburg

2:29 pm on Apr 15, 2003 (gmt 0)

10+ Year Member



nativenewyorker: how would I go about doing this?

Jim: Thanks I'll try that out.

nativenewyorker

4:20 am on Apr 19, 2003 (gmt 0)

10+ Year Member



Quarfelburg,

I am not sure how you do it, but I believe there are ways to select a proxy IP with MS IE. There may be other ways to surf the web thru a proxy server using specialized software. I can't be more specific because I don't use it myself. Just do a search for proxy servers.

Ted

 

Featured Threads

Hot Threads This Week

Hot Threads This Month