Views: 1 visits
Iran reverse proxy SEO concept – main domain connected to subdomain in isolated Iranian server

Iran reverse proxy SEO is a powerful technique that allows your main domain to stay crawlable and accessible during times when Iranian servers are isolated from the global internet. When national-level shutdowns or firewall restrictions occur, Google and international users lose access to your website — and your SEO rankings may suffer.

What if you could keep your main domain SEO-friendly and fully accessible — without migrating all your content or purchasing multiple international hosting plans?

This guide introduces a smart, cost-effective solution using a reverse proxy technique that fetches content from your original (isolated) Iranian server and displays it through a foreign-accessible server under your main domain.


🧩 Real-World Scenario: SEO Risks During Isolation

One of our users experienced a critical issue during an internet blackout. Their website, hosted on an Iranian server, became unreachable for Googlebot and users outside Iran. To solve this without migrating large volumes of data, they flipped the traditional proxy method:

  • Kept the main domain hosted on a new Iranian server that had global internet access
  • Moved the original site to a subdomain hosted inside the isolated Iranian network
  • Used a reverse PHP proxy script on the main domain to fetch content from the subdomain

This setup ensured uninterrupted SEO indexing and access for users worldwide.


✅ What You Need to Get Started

To implement this Iran reverse proxy SEO method:

  • Two shared or VPS hosting environments, both inside Iran
  • The isolated host (with no global internet) hosts the real site under a subdomain like sub.domain.com
  • The accessible host (with global internet) holds the main domain like domain.com
  • PHP + cURL enabled on both hosts

💻 PHP Reverse Proxy Script

Use the following lightweight script on the main domain to pull content from the subdomain:

<?php
$subPath = $_SERVER['REQUEST_URI'];
$basePath = '/';
$remotePath = ltrim($subPath, '/');

$remoteUrl = "https://sub.domain.com/" . $remotePath;

$ch = curl_init($remoteUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    http_response_code(500);
    echo "Connection error: " . curl_error($ch);
    exit;
}

$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = substr($response, $header_size);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);

if ($contentType) {
    header("Content-Type: $contentType");
}

curl_close($ch);
echo $body;
?>

🔧 How Iran Reverse Proxy SEO Works

  • Users or bots access domain.com/page
  • The PHP script fetches content from sub.domain.com/page
  • Google indexes domain.com while content loads from the subdomain

This technique maintains original domain authority and ranking.


🔐 Security & SEO Tips

  • Use .htaccess or firewall rules to restrict public access to the subdomain
  • Allow only known IPs or use token authentication if needed
  • Ensure canonical tags still point to domain.com
  • Use caching on the proxy to reduce load

📥 Download the Ready-to-Use PHP Proxy Script

You can download a full version of this reverse proxy setup as a product from our site:

👉 Download PHP Reverse Proxy Script


📘 More Resources

For a related scenario on how to use PHP proxy scripts for bypassing international restrictions (especially during outages), read our previous guide:

➡️ PHP Proxy for Internet Shutdown in Iran

Or learn from Google’s SEO Guide for additional best practices.


❓ FAQ

Does this affect my SEO negatively?
No — if implemented properly, the proxy allows Google to crawl your main domain just like it normally would.

Do I need to move all content to the new host?
No — only the PHP script needs to run on the accessible host. Content remains on the original server.

Will users inside Iran see any difference?
No. The proxy serves the content transparently.


If this Iran reverse proxy SEO guide helped you, feel free to share it or leave a comment below. The p30script.com team is always here to support your smart web strategies.

Read more