Internal paths
You web site or your web application can be put everywhere, in a domain (eg. www.mydomain.com) or in a subfolder (eg. www.mydomain.com/myapp).
If you install X3 CMS in the final location, X3 automatically will set right value for all internal paths.
What if you need to move X3 CMS to another location?
Files
You need to edit the .htaccess file, here you have to change the path in a few rows
You have 2 elements: the domain name and the subfolder if exists
errorDocument 403 http://YOUR_NEW_DOMAIN/SUBFOLDER_IF_EXISTS/msg/message/_page_not_found
errorDocument 404 http://YOUR_NEW_DOMAIN/SUBFOLDER_IF_EXISTS/msg/message/_page_not_found
RewriteEngine On
RewriteBase /SUBFOLDER_IF_EXISTS
# remove comment redirect all traffic with www and without www to the same domain
RewriteCond %{HTTP_HOST} !^YOUR_NEW_DOMAIN_WITH_WWW [NC]
RewriteRule ^(.*)$ http://YOUR_NEW_DOMAIN_WITH_WWW/$1 [L,R=301]
Database
In the database you have 2 changes:
- Edit the domain field in the sites table
- If you move to a subfolder or from a different subfolder you need to change all the image and href paths in the content field in the table articles
To solve run this query after a backupUPDATE articles SET content = REPLACE(content, '="/old_subfolder/', '="/new_subfolder/')
Other paths
X3 CMS define some shortcuts that help you write code easily:
ROOT
The ROOT is the portion of the URL between the domain name and the language code. In the examples below the ROOT is formatted as bold:
- http://www.mydomain.com/mysubfolder/en/my_page
- http://www.mydomain.com/en/my_page (the slash after .com)
- http://www.mydomain.com/en/public/my_page (the slash after .com)
NOTE: the ROOT starts and ends with a slash
BASE_URL
The BASE_URL = ROOT + language_code + / + area_name + /
Is very useful when you need to write an internal link, see the example below
<a href="/en/admin/articles/edit/2/en/1/<?php echo BASE_URL ?>page_name" title="a page">a page</a>
This way you don't care about language code and area name, X3 CMS will set those of the page where you are.
THEME_URL
The THEME_URL is a shortcut to the folder of the theme of the area where you are. Useful to link theme's elements. See the example below
<img src="/en/admin/articles/edit/2/en/1/<php echo THEME_URL ?>img/my_image.jpg" alt="image caption">
PATH
PATH is the absolute path of X3CMS in the computer
PATH = DOCUMENT_ROOT + ROOT
APATH
APATH is the absolute path of the application folder (for X3 CMS the application folder is cms) in the computer
APATH = DOCUMENT_ROOT + ROOT + 'cms/'
FPATH
FPATH is the absolute path to the files folder in the application folder with the prefix foer the domain
FPATH = DOCUMENT_ROOT + ROOT + 'cms/files/'+PREFIX+'/filemanager/'
* DOCUMENT_ROOT is the document folder of your web server