1

i need a if condition, witch detects main url, for one of my important functions.

if ($_SERVER[HTTP_HOST] == www.example.com) { echo its a root page; }
else { echo its a subdomain page; }

my site(magento) is installed in subdomain; and im getting some pages from root via static php pages.(with htaccess)

now.. when I try HTTP_HOST in root pages(www.example.com/about), the value returns subdomain.example.com (!!??) - maybe because of htaccess or magento structure)

But I need 'hey its a root page' for example.

Can I use any more mothods which is not similar PHP_SELF, HTTP_HOST etc?

PHP Worm...
  • 4,109
  • 1
  • 25
  • 48
Stackyy
  • 21
  • 4
  • Is there a variable in `$_SERVER` that you can use to detect the rewrite from the www domain to the subdomain? – Halcyon Jun 08 '15 at 13:04
  • my root htaccess is this: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php – Stackyy Jun 08 '15 at 13:06
  • Dear Halcyon, i couldnt find any ready-to use variable.. but when i say echo $_SERVER[HTTP_HOST] in www/root pages, it returns subdomain adresses. – Stackyy Jun 08 '15 at 13:16
  • Can you show us your rewrite rules? – Halcyon Jun 08 '15 at 13:21
  • rewrite rules means httaccess in root? i wrote in my first comment. but its not the point i think.. it only make example.com/url to example.com/url.php.. the point is in the url.php's dynamic content (it get his content from subdomain by requesting blocks, functions, classes etc) – Stackyy Jun 08 '15 at 13:35

0 Answers0