Base URL issue in Subdomain I have my main site as example.com and also I am running the below subdomains with help of subdomain module


one.example.com 
two.example.com


I have created the html block(admin/structure/block/add) for footer to list my site links. This block is visible for main domain(example.com) and all subdomains(one.example.com,two.example.com)

But I have URL issues in that footer block in subdomains.
For example I have &lt;a href="/suggestions"&gt;Suggestions&lt;/a&gt; in footer block, when I am in main domain it goes to http://example.com/suggestions. It goes to http://one.example.com/suggestions &amp; http://two.example.com/suggestions when I am in subdomains.

BUT IT SHOULD GOES TO ONLY http://example.com/suggestions FOR ALL SUBDOAMINS

Any way to achieve this?
I like adding the redirect to sites/default/settings.php instead of .htaccess (just because Pantheon ignores .htaccess redirects and a lot of my sites are hosted on Pantheon). I'm also just more comfortable with the syntax.

The first example will redirect just /suggestions to example.com/suggestions. The second example redirects any path beneath /suggestions (e.g., /suggestions/submit or /suggestions/submit/thankyou) to that same path on the main domain (example.com).

In terms of wild-carding this solution for scenarios similar to 'suggestions', I don't think that would work. I mean you don't want to redirect everything so you have to check for a specific REQUEST_URI. 

But you could use this solution as a template for the other redirects you need. If you have a very large number of these (or anticipate a large number in the future), you might consider switching to the Domain Access module instead as it would handle this scenario without any redirects or custom coding.

You'll need to update 'example.com' to match your main domain and you may need to change 'http' to 'https' is you're using TLS.

// 301 Redirect from /suggestions to example.com/suggestions
if ($_SERVER['HTTP_HOST'] != 'example.com' &amp;&amp;
  $_SERVER['REQUEST_URI'] == 'suggestions' &amp;&amp;
  (php_sapi_name() != "cli")) {
    header('HTTP/1.0 301 Moved Permanently');
    header('Location: http://example.com/suggestions');
    exit();
  }

// 301 Redirect from /suggestions/* to example.com/suggestions/*
if ($_SERVER['HTTP_HOST'] != 'example.com' &amp;&amp;
    $_SERVER['REQUEST_URI'] == 'suggestions' &amp;&amp;
    (php_sapi_name() != "cli")) {
      $url = $_SERVER['REQUEST_URI'];
      $url = substr($url, 13); // stripping '/suggestions/' which is 13 chars
      header('HTTP/1.0 301 Moved Permanently');
      header('Location: http://example.com/suggestions/'. $url);
      exit();
  }