homepage Welcome to WebmasterWorld Guest from 54.196.196.62
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Excluding IP on .htaccess
Quarfelburg




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

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




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

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




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

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




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

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




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

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




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

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




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

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

Thanks,
Hayden

nativenewyorker




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

Quarfelburg:

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

Ted

jdMorgan




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

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




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

nativenewyorker: how would I go about doing this?

Jim: Thanks I'll try that out.

nativenewyorker




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved