Solved

htaccess redirect problem

Posted on 2013-11-09
5
281 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

762 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

18 Experts available now in Live!

Get 1:1 Help Now