Changing the default URL doesn't work as expected

More
3 years 3 weeks ago #114705 by CrystalBlood
CrystalBlood created the topic: Changing the default URL doesn't work as expected
I have been working with this initiative for several days without the desired outcome.

Hypothetically I have the domain www.parking.com in one server.

In another server (192.168.1.100) I have the Limesurvey 2.05+ installed, and I want to access to my Limesurvey installation through the URL: www.parking.com/surveys/

So, in the first server, in the virtualhost file of the apache, goes something like:

<VirtualHost *:80>
    ServerName  www.parking.com
    ServerAlias www
    ..
    ..
     ProxyPass /surveys/  http://192.168.1.100/
     ProxyPassReverse /surveys/  http://192.168.1.100/
    ..
    ..
</VirtualHost>


And in the limesurvey server in the virtualhost conf file of the apache, goes something like:
<VirtualHost *:80>
    ..
    ..
    DocumentRoot "/var/www/html/limesurvey205plus"
    ErrorLog "/var/log/httpd/limesurvey205plus_error_log"
    CustomLog "/var/log/httpd/limesurvey205plus_access_log" common
    <Directory /var/www/html/limesurvey205plus>
       DirectoryIndex index.html index.php
       AddHandler php5-script .php
       Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
       AddType text/html .php
       AllowOverride All
       Allow from all
    </Directory>
</VirtualHost>


The /var/www/html/limesurvey205plus directory is where the limesurvey is installed.


Besides, is well know that we have our config.php file, and we have to add a new item in the components array like this, and I also tried to add something in the config array:

return array(
        'components' => array(
                'db' => array( .. ),
 
                // new addition
                'request' => array('hostInfo' => 'http://www.parking.com/surveys/'),
 
		..
		..
 
        ),
 
        'config'=>array(
                'debug'=>0,
                'debugsql'=>0 
 
		// new addition
                ,'publicurl' => 'http://www.parking.com/surveys/'
                ,'homeurl'=> 'http://www.parking.com/surveys/'
        )
 
);

I went a little further and also commented some lines in the file config-defaults.php because I experimented some glitches with the productions of the URLs.

Commented this:
/*
if(!isset($argv[0]))
{
    $config['publicurl'] = Yii::app()->baseUrl . '/';                          // The public website location (url) of the public survey script
}
else
{
    $config['publicurl'] =  '/';
}
*/
 
// And added this
    $config['publicurl'] =  'http://www.parking.com/surveys/';

In the browser, we access without problems to the limesurvey URL like this: www.parking.com/surveys/ , if I want to login then I go to: www.parking.com/surveys/admin/ and this properly redirect me to: www.parking.com/surveys/index.php/admin/authentication/sa/login displaying the login form, but once I tried to do the proper login, it redirects me to the home of www.parking.com .

Any clues?

Please Log in to join the conversation.

More
3 years 3 weeks ago #114755 by CrystalBlood
CrystalBlood replied the topic: Changing the default URL doesn't work as expected
Fixed!

First, we change the name of our installation folder, it needs to have the same name of the URL that we want to access. Therefore, /var/www/html/limesurvey205plus we change to /var/www/html/surveys

In the " www.parking.com " server, in the virtualhost file of the apache:
<VirtualHost *:80>
    ServerName  www.parking.com
    ServerAlias www
    ..
    ..
      RewriteRule ^/surveys$  /surveys/ [R]
 
      ProxyPass /surveys/  http://192.168.1.100/surveys/
      ProxyPassReverse /surveys/  http://192.168.1.100/surveys/
    ..
    ..
</VirtualHost>

We reload the *.conf file.

Then in the limesurvey server, the virtualhost conf file:
<VirtualHost *:80>
    ..
    ..
    DocumentRoot "/var/www/html/"
 
    ErrorLog "/var/log/httpd/surveys_error_log"
    CustomLog "/var/log/httpd/surveys_access_log" common
 
    <Directory /var/www/html/surveys>
       DirectoryIndex index.html index.php
       AddHandler php5-script .php
       Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
       AddType text/html .php
       AllowOverride All
       Allow from all
    </Directory>
</VirtualHost>

Reload the *.conf file.

Finally, in our config.php:
return array(
        'components' => array(
                'db' => array( .. ),
 
                //Set the base Url for all Complete url
                'request' => array('hostInfo' => 'http://www.parking.com/'),
 
        ..
        ..
 
        ),
 
        ..
        ..
 
);

More information in this link

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!