.htaccess issue

Status
Not open for further replies.

brianvidguy

New Member
Messages
5
Reaction score
0
Points
0
I posted this in Feedback cause I couldn't figure out how to post here, but then someone decided to close so I couldn't ask for further help. Thank you whoever did that, alot of good that did.

Anyways, read this thread right here about the .htaccess to understand my problem: http://x10hosting.com/forums/free-hosting/130042-posting-issues.html

deny from all
allow from 192.168.1.1 (fake IP)

If I had my IP address in that place, it wouldn't work. It would deny from all, but still wouldn't allow that IP Address.

In the last topic I was told that I won't be able to do it this way anymore? Why is this?

and how do I implement $_SERVER['HTTP_X_FORWARDED_FOR'] with a .htaccess file. Right now my 403 page is set to comingsoon.php. Does this mean I have to put this PHP code in every page I want blocked from seeing and then somehow redirect to comingsoon.php?

I need assistance with this. This is a temporary fix right? Will the .htaccess with allow from work again soon?
 

Anna

I am just me
Staff member
Messages
11,750
Reaction score
581
Points
113
Hello,

I'm trying to get confirmation about this from our server administrators and will get back to you as soon as I get an answer.
 

Anna

I am just me
Staff member
Messages
11,750
Reaction score
581
Points
113
Hello,

I have talked with one of the administrators, they are working on finding a solution, but sadly can not say for sure there is one. The reason for this problem is the load balancing we've put in play, the actual server that displays your site can as it is now only see the forwarding servers IP, in your case the IP for Starka.

There is an option to get around this with mod_rewrite in .htaccess though.

RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-For} !^192\.168\.91\.5 - If the forwarded IP is NOT 192.168.91.5
RewriteCond %{REQUEST_URI} !/temporary-offline\.html$ - if the address requested is NOT temporary-offline.html
RewriteRule .* /temporary-offline.html [R=302,L] - send them to temporary-offline.html (using temporary redirect, 302, in this example, but would of course also work with other redirect options)
 

brianvidguy

New Member
Messages
5
Reaction score
0
Points
0
That code works perfectly, however my page is redirecting to comingsoon.php, but it is displayed with no style.css and no images. How can I add a little code to make sure those are also allowed to be seen. For example, I have a whole directory of images for that page (/images/) and then style.css individually.

Thanks in advanced! Brian

P.S. The method you are giving me is temporary, maybe. What else exactly was changed during this move/restore so I know what I can and cannot do.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Code:
RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-For} !^192\.168\.91\.5 192.168.91.5
RewriteCond %{REQUEST_URI} !/temporary-offline\.html$ 
RewriteCond %{REQUEST_URI} !/style\.css$ 
RewriteCond %{REQUEST_URI} !/images/.*$ 
RewriteRule .* /temporary-offline.html [R=302,L]
 

brianvidguy

New Member
Messages
5
Reaction score
0
Points
0
Code:
RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-For} !^192\.168\.91\.5 192.168.91.5
RewriteCond %{REQUEST_URI} !/temporary-offline\.html$ 
RewriteCond %{REQUEST_URI} !/style\.css$ 
RewriteCond %{REQUEST_URI} !/images/.*$ 
RewriteRule .* /temporary-offline.html [R=302,L]

Hmm, that allowed me to view style.css (in a test form), but it didn't allow it to load with the redirected page. Images aren't loading either.

Here's my code. Not much different.
Code:
RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-For} !^96\.243\.***\.***
RewriteCond %{REQUEST_URI} !/comingsoon\.php$
RewriteCond %{REQUEST_URI} !/style\.css$ 
RewriteCond %{REQUEST_URI} !/images/.*$ 
RewriteRule .* /comingsoon.php [R=302,L]


---------- Post added at 07:08 PM ---------- Previous post was at 06:55 PM ----------

Actually, I found part of the problem. The file is named comingsoon.css so I changed it and now css is displaying but now images folder. Maybe I need to call each image separately?
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
This seems to be resolved so I am closing it. If further assistance is required please re-open this thread or create a new one. You can re-open this thread by clicking on the "Administrative" text at the top of the original post.
 
Status
Not open for further replies.
Top