Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Dec 30, 2014 8:01 pm 
Offline
Newbie

Joined: Tue Dec 30, 2014 7:53 pm
Posts: 2
Hi folks,

I'm trying to get some help with setting up a redirect properly. I'm not too skilled with .htaccess, so I likely have something coded incorrectly. I have it working correctly if I redirect users to say google, but not when I try to redirect users to a different directory on the same server.

what I'm trying to accomplish is to redirect all traffic, excluding 2 IP addresses, to an index.html file in a certain directory that's found on the server.

here's the code I'm using:

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule .* http://www.mysite.com/new [R=302,L]


my IP is plugged in where 1.2.3.4 is listed as well as the mysite.com/new being replaced with my domain name.

directory set up:

apache is reading files from /var/www. the .htaccess resides in /var/www/. I'd like to redirect all users to an index.html file found in /var/www/new/. is this possible? if so, how is it properly written in the .htaccess file?

I also tried this code, and it hasn't worked:

Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule ^/$ /new/ [R]


any help is appreciated.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group