FORUM IS CLOSED. PLEASE USE QUESTIONS / ANSWERS PAGE INSTEAD
Login  |  Forum  |  Search   

Board index » Development » Help requests




Post new topic Reply to topic  [ 6 posts ] 
 
Author Message
 Post subject: install in subfolder
 Post Posted: Mon Dec 28, 2009 11:23 pm 
Offline

Joined: Mon Dec 28, 2009 11:09 pm
Posts: 6
I have installed impresspages in a subfolder called /impress to avoid all files of impresspages are in the root.

Every hyperlink results in "Sorry, but the page you were trying to get to, does not exist."

I want this structure:
http://www.(mydomain).com/en/left/text/
However impresspages expects this structure:
http://www.(mydomain).com/impress/en/left/text/

My main /.htaccess file:

Code:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/impress
Rewriterule ^(.*)$ /impress/$1 [L]


My /impress/.htaccess file:

Code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [L]


And my /impress/ip_config.php

Code:
define('BASE_URL', 'http://www.(mydomain).com/');


I really appreciate any suggestion on this subject as I think I'm close to it but cannot find what I'm doing wrong.


Top 
 Profile  
 
 Post subject: Re: install in subfolder
 Post Posted: Tue Dec 29, 2009 12:50 pm 
Offline

Joined: Tue Nov 24, 2009 12:10 pm
Posts: 111
propably mess with htaccess :)

htaccess gets some settings from parent folders - so probalby this "RewriteBase /" in main htaccess give you errors

delete htaccess in main directory and try if it works from subdir, if works try to use RewriteBase /impress/

or htaccess like this should help

RewriteEngine On
RewriteRule ^(.*)$ impress/$1 [L]

you could add then also RewriteBase / and at least try this


RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com
RewriteCond %{REQUEST_URI} !^/impress
Rewriterule ^(.*)$ /impress/$1 [L]


Top 
 Profile  
 
 Post subject: Re: install in subfolder
 Post Posted: Tue Dec 29, 2009 2:00 pm 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
I think it is much more complicated :roll: .

I suggest You to leave all ImpressPages CMS files in the root and move all directories to subfolder:

Code:
     define('IMAGE_DIR', 'subfolder/image/');  //uploaded images directory
     define('TMP_IMAGE_DIR', 'subfolder/image/tmp/'); //temporary images directory
     define('IMAGE_REPOSITORY_DIR', 'subfolder/image/repository/'); //images repository. Used for TinyMCE and others where user can browse the images.
     define('FILE_DIR', 'subfolder/file/'); //uploded files directory
     define('TMP_FILE_DIR', 'subfolder/file/tmp/'); //temporary files directory
     define('FILE_REPOSITORY_DIR', 'subfolder/file/repository/'); //files repository. Used for TinyMCE and others where user can browse the files.
     define('VIDEO_DIR', 'subfolder/video/'); //uploaded video directory
     define('TMP_VIDEO_DIR', 'subfolder/video/tmp/'); //temporary video directory
     define('VIDEO_REPOSITORY_DIR', 'subfolder/video/repository/'); //files repository. Used for TinyMCE and others where user can browse the files.
     define('AUDIO_DIR', 'subfolder/audio/'); //uploaded audio directory
     define('TMP_AUDIO_DIR', 'subfolder/audio/tmp/'); //temporary audio directory
     define('AUDIO_REPOSITORY_DIR', 'subfolder/audio/repository/'); //audio repository. Used for TinyMCE and others where user can browse the files.


unfortunately you can't move ip_cms folder.


Top 
 Profile  
 
 Post subject: Re: install in subfolder
 Post Posted: Wed Dec 30, 2009 1:37 pm 
Offline

Joined: Mon Dec 28, 2009 11:09 pm
Posts: 6
I've isolated the root cause to be related to the parseUrl() function within ip_cms/frontend/site.php

All was ok in my .htaccess files already provided in my initial post. (thanks anyway Sokolowski). The provided workaround from maskas is not good enought, I really don't want files in my root, only one directory.

Some background info:

Having the folder structure:
http://www.(mydomain).com/impress/en/left/text/
and the url structure:
http://www.(mydomain).com/en/left/text/
and the .htacces described above to make this happen.

Then it will reach the impresspages with the following server variables set:
$_SERVER['SCRIPT_NAME'] = '/impress/index.php'
$_SERVER['REQUEST_URI'] = '/en/left/text/'

Now the function parseUrl() located in ip_cms/frontend/site.php on line 228 will not properly extract the paramaters from the url. I've solved this to change the first code line of this function:

Code:
$urlVarsStr = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['SCRIPT_NAME'], '/') + 1, 300);


Into:

Code:
$scriptPath = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/') + 1 );
if( strpos($_SERVER['REQUEST_URI'] , $scriptPath ) === 0 ) {
  $urlVarsStr = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['SCRIPT_NAME'], '/') + 1, 300);
} else {
  $urlVarsStr = substr($_SERVER['REQUEST_URI'], 1, 300);
}


The idea behind is that normally the path of the script_name is also the first part of the request_uri. Impresspages is presuming this always to be true. However when using the mod_rewrite this can be different. I first check if the scriptPath does exist in the request_uri (on position zero, that's why it needs === to separate from false) , if so then the normal $urlVarsStr is kept. If not then the $urlVarsStr is based on the request_uri without the first slash '/'.

This worked for me and I hope this will contribute to the impresspages development and if further explanation is needed then please let me know.


Top 
 Profile  
 
 Post subject: Re: install in subfolder
 Post Posted: Wed Dec 30, 2009 1:52 pm 
Offline

Joined: Tue Nov 24, 2009 12:10 pm
Posts: 111
Great job, thanks for solution - Im still waiting for next release IP, and sure will try Your code when its out. My new website should by developed on IP to test and translate IP.

@Maskas - any news about release date ? Im waiting with personal portfolio ;)


Top 
 Profile  
 
 Post subject: Re: install in subfolder
 Post Posted: Thu Jan 14, 2010 11:39 am 
Offline
Project Developer

Joined: Tue Apr 28, 2009 9:43 am
Posts: 1720
We have included this fix.


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 6 posts ] 

Board index » Development » Help requests


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: