Search

Installing Symphony on a new webhost (transip.nl) I ran into the issue of an annoying PHPSESSID in the url.

As this seems (I need to ask them) to be something they do not want to change in their configuration I need to add the following to either the (Symphony) PHP files:

<?php
    ini_set('session.use_trans_sid', 0);
    ini_set(‘session.use_only_cookies’, 1);
?>

or I need to change the .htaccess file to include:

php_flag session.use_trans_sid off
php_flag session.use_only_cookies on

Unfortunately this host does also not allow php_flag in a .htaccess

Now for my question: (I’m no PHP expert) I’ve added the init_set() instructions to the /manifest/config.php file and it seems to work fine. Is this the right place to put these instructions?

Also: Another (unrelated) issue I came across: I’m using a temporary hostname (since my DNS is not yet changed) and some(!) of my pages redirect to the final domain-name.

E.g.: http://mytempsite.transip.nl/ goes fine, but
http://mytempsite.transip.nl/about-us redirects to http://myfinal.nl/about-us

This occurs only when I omit the trailing slash: http://mytempsite.transip.nl/about-us**/** goes fine.

I could not find where (if?) Symphony redirects to the ‘org host’. I know there’s some redirection in the .htaccess but I can’t see how this would redirect to the org. hostname… Any ideas?

UPDATE:

Actually, I think this last issue is a strange coincidence that uncovers a ‘bug’ in the Symphony .htaccess redirection rules.

My ‘temp’ domain is: http://client.nl.business3.webhosting.transip.nl while my client’s ‘final’ domain is http://client.nl

The .htaccess redirect says:

### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

… If I’m correct, the regex merely picks up ‘standard’ domains (www.domain.nl) and incorrectly picks up subdomains: foo.nl.bar.baz.com results in foo.nl.

Edit: Meh, I’m actually not so sure anymore this is the issue. The ^(.*)$ should pick up the whole domain correctly (right?) and $1 should just be the original domain (right?). Again: I’m not very RegEx knowledgable. Maybe TransIp is just replacing the domains internally, or something…

As a coincident (?) client.nl happens to be the old/new domain.

Am I right in assuming this regex is not fail-safe? Can some regex guru propose a rule which will correctly handle domains in the form of http://client.nl.business3.webhosting.transip.nl/ ?

Process following Rule only if the string after the domain name is not a file:

RewriteCond %{REQUEST_FILENAME} !-f

Process following Rule only if the string after the domain name does not end with a /

RewriteCond %{REQUEST_URI} !/$

Process following Rule only if the string after the domain name does not end with any (one or more) character followed by a /

RewriteCond %{REQUEST_URI} !(.*)/$

Rule: ^ = start of string after the domain-name/ $ = end of string (.*) = any character, 1 or more. Wrapping this in parentheses means that the $1 is a copy of the string.

RewriteRule ^(.*)$ $1/ [L,R=301]

You could temporarily add the following above the FavIcon ruleset:

RewriteCond %{HTTP_HOST} !client\.nl\.business3\.webhosting\.transip\.nl/?$ [NC]
RewriteRule (.*) http://client.nl.business3.webhosting.transip.nl/$1 [R,L]

@designermonkey thx. I figured most of that out :/

Actually it seems to be an issue with the host, replacing the tmp. domain with the org. one on a rewrite. I don’t know why or how, but (as you say) the rewrite rule seems to be fine.

I solved it (temp) by actually hardcoding the domainname. Added the domainname before the $1/. This does the trick. As the site goes live and the DNS is switched I should change it but I think it will no longer be a problem.

Thanks for your answer.

As for the first question: is the config.php the best place for those settings instructions?

Additionally, Symphony does not have any input on how your domain redirects itself. It uses the string after the domain only. It sounds to me like something is going awry somewhere on the DNS setup.

All the rewrite rule above is capable of is rewriting from a non trailing slash to a trailing slash. As .nl is a registered ‘top level domain’ having it in the domain name way before the domain string ends is probably causing the problem. It may be confusing the DNS servers.

I know it’s not your fault, but having that many levels in a domain is silly, especially having the top level name in there too…

I hope my rule can help, otherwise you may have to wait until your domain is ready…

Hey, you answered too quick!

Personally, any changes like that, I make in the top of the index.php file, but if it works in the config file, leave it there. config.php isn’t overwritten in upgrades so it would be safer there…

Cool. thanks ;-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details