Solved

Apache Redirection

Posted on 2009-03-30
5
430 Views
Last Modified: 2012-05-06
   What is the best redirection to add for Google rating during the maintanance time.Currently we are adding the following lines during maintanance.

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^192\.168\.
    RewriteRule /splash/index.html / [R=301,L]

    Google is threatening to remove some sites from their ranking completely due to this.
0
Comment
Question by:linuxraja
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 24018344
If you're doing some maintenance and your site is not available, HTTP 503 Service Unavailable should be the more appropriate status code.

If you're on apache 2.2, you could use
RewriteEngine on

RewriteCond %{REMOTE_ADDR} !^192\.168\.

# only /splash/index.html? /foo/bar should be served?

RewriteRule /splash/index\.html - [R=503]

Open in new window

0
 

Author Comment

by:linuxraja
ID: 24018950
After adding this its Providing syntax error while restarting apache

RewriteRule: invalid HTTP response code for flag 'R'
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 24019275
> RewriteRule: invalid HTTP response code for flag 'R'

> "If you're on apache 2.2"

So you're not on apache 2.2 but on an older branch, hence you can't issue a 503 with mod_rewrite.

What you can do is to rewrite (internally) to some script, e.g. php or perl or whatever and use the header/status functions to set a http status code provided by the language of you choice.
RewriteEngine on

RewriteCond %{REMOTE_ADDR} !^192\.168\.

RewriteRule /splash/index\.html /internal-script.php [L]

Open in new window

0
 

Author Comment

by:linuxraja
ID: 24133677
This seems good. Can you give me the content of  internal-script.php script
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 24135270
Something like


<?php

header("HTTP/1.0 503 Service Unavailable");

header("Status: 503 Service Unavailable");

?>

Open in new window

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

23 Experts available now in Live!

Get 1:1 Help Now