Solved

htaccess redirect problem

Posted on 2013-11-09
5
290 Views
Last Modified: 2013-11-09
Hi,

I want all users to go from website.com or www.website.com to be directed to update.domain.com

Not working

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.211
RewriteCond %{REQUEST_URI} !^/ [NC]
RewriteRule ^(.*)$ http://update.domain.com/$1 [R=302,L]
0
Comment
Question by:Computer Guy
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39636398
RewriteCond %{HTTP_HOST} !^update\.domain\.com$ [NC]
RewriteRule ^blog/$ http://update.domain.com [L,NC,R=301]
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 39636420
Sorry, all users except ones with a specific IP
0
 
LVL 58

Expert Comment

by:Gary
ID: 39636422
Just add in your line then before the Rule
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.211
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 39636424
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.211
RewriteCond %{HTTP_HOST} !^update\.domain\.com$ [NC]
RewriteRule ^blog/$ http://update.domain.com [L,NC,R=301]

what is the blog on line 3?

also, when they goto domain.com for any file they should be redirected to update.domain.com
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39636430
That should be
RewriteRule (.*) http://update.domain.com [L,NC,R=301]

(missed it copying from my code samples)
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now