Solved

htaccess

Posted on 2013-12-02
7
304 Views
Last Modified: 2013-12-19
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?
0
Comment
Question by:tweddlewalker
  • 3
  • 3
7 Comments
 
LVL 57

Expert Comment

by:giltjr
ID: 39692285
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
 

Author Comment

by:tweddlewalker
ID: 39715921
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
 
LVL 57

Expert Comment

by:giltjr
ID: 39716691
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:tweddlewalker
ID: 39718893
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
 
LVL 57

Accepted Solution

by:
giltjr earned 500 total points
ID: 39719275
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
 

Author Closing Comment

by:tweddlewalker
ID: 39730307
Thank you for your contribution
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

830 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