htaccess

Want to use .htaccess to:
1. redirect specific and mutiple ip adresses
2. from http://www.mysite.com
3 to http://www.subsite.mysite.com/newpage.php

Efforts with RewriteCond... end in failure

Could anyone please help?
tweddlewalkerAsked:
Who is Participating?
 
giltjrConnect With a Mentor Commented:
Still not sure what you mean by restricted.  You wanted to redirect to a new URL.

Is the redirection working?

As for the Internal Server error, what messages are you seeing in Apache's access and error logs?
0
 
giltjrCommented:
Not sure but the following should rewrite a request with no URI (that is just plain /) from a host with the IP address of 123.45.67.8

RewriteCond   %{REQUEST_URI} ^\/
RewriteCond %{REMOTE_ADDR}       123\.45\.67\.9
RewriteRule   /(.*) http://www.subsite.mysite.com/newpage.php

It MIGHT put you in a loop so be careful. : )
0
 
tweddlewalkerAuthor Commented:
Sorry for the delay in replying to your suggestion; thank you for it. I have been away.

Access is certainly restricted but we get an Internal Server Error message. Any thoughts?
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
giltjrCommented:
Not sure what you mean by "access is certainly restricted."

What type of error?

Do you happen to have PHP or some other service side scripting language installed?
0
 
tweddlewalkerAuthor Commented:
1. that access is restricted to the site from that ip address

2. the message is "Internal Server Error"

3. no; the htaccess file is as recommended
0
 
tweddlewalkerAuthor Commented:
Thank you for your contribution
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.