0
votes

i developed a site with modx in the subdomain 2012.m-y-d-o-m-a-i-n.de. The old site was running in oldsite.m-y-d-o-m-a-i-n.de. The site was redirected from mydomain.net (without dashes) to oldsite.m-y-d-o-m-a-i-n.net. the site admin switched yesterday to the newsite 2012.m-y-d-o-m-a-i-n.net. FURL is turned on and in the htaccess I have this code:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  # Friendly URLs
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Redirect works, but all links refer to the 2012.m-y-d-o-m-a-i-n-de. How can I teach modx the new siteURL variable. I used the setup again and I cleared cache several times and the site still believes it is in the subdomain of m-y-d-o-m-a-i-n-de. The subdomain should vanish out of every URL. Both DNS entrys run the the same server. Thank you for help

3
Is that MODx Evolution or Revolution? - okyanet
You question doesn't make much sense. It's riddled with misused technical term, making it totally unreadable. Please state what urls you had, which urls you have now, and where you want each urls to redirect to. - Gerben
Its modx revolution. I'll try to explain again, indeed I mixed some stuff up: my modx is installed under 2012.m-y-d-o-m-a-i-n.de. There's a redirect from www.anotherurl.tld The site home gets called and it works - probably through the "funnel all hits to home"-method. Wayfinder builds the menu with 2012.m-y-d-o-m-a-i-n.de because [[$siteurl]] shows that domain. I wan't to configure my htaccess or modx that everything works with www.anotherurl.tld. How could I achieve this. Sry that I mix subdomain and everything up. Thank you for help - Johannes

3 Answers

1
votes

The usual solution is to add this tag to the head section of all templates:

<base href="[[++site_url]]" />

You don't need to add any defines. MODX will calculate the site_url based on the URL the user comes in on (after the redirect). Hard-coding the site_url will cause trouble if you move the site.

You should also uncomment the part of .htaccess that forces www or non-www URLS. Without that MODX can lose the session if the user gets switched from one to the other.

0
votes

You want to set up a rule in your .htaccess file that will check the incoming URL and redirect it to www.mydomain.de if that is not already the case.

Place this code before the # Friendly URLs comment in your existing .htaccess:

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^(www)\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

This will catch http://2012.mydomain.de, http://2011.mydomain.de, http://mydomain.de etc and the 301 code will inform crawlers that the subdomain has permanently moved to the www domain.

0
votes

Check core/config/config.inc.php, see if it still has your old domain in there. If it's still getting the wrong domain, add defines to set your site url and host as you need, around line 23:

define('MODX_HTTP_HOST','www.YOURDOMAIN.com');
define('MODX_SITE_URL','http://www.YOURDOMAIN.com/');