Difference between revisions of "X-Cart:Moving store to web-root directory"

From X-Cart 4 Classic
Jump to: navigation, search
(added RewriteCond %{REQUEST_URI} !^/server-status)
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
Here are general instructions on how to move your cart to the web-root directory:
 
Here are general instructions on how to move your cart to the web-root directory:
  
1. Make sure your product and category images are stored in the database. If they are stored on the filesystem, you should temporarily move them to the database. You can do this under the "Images location" section of the admin interface.
+
{{XC 4.0|or earlier}}
 +
 
 +
1. If you are using X-Cart 4.0.19 or earlier, make sure your product and category images are stored in the database. If they are stored on the filesystem, you should temporarily move them to the database. You can do this under the "Images location" section of the admin interface.
  
 
2. Move all files from the directory where X-Cart installed to the root web directory. You can do this using either FTP or (better) SSH access. File permissions must be preserved during the copying, otherwise you will need to adjust the permissions manually.
 
2. Move all files from the directory where X-Cart installed to the root web directory. You can do this using either FTP or (better) SSH access. File permissions must be preserved during the copying, otherwise you will need to adjust the permissions manually.
Line 7: Line 9:
 
3. Edit <u>config.php</u> file adjusting '''$xcart_web_dir''' parameter. If your cart was installed in the "store" directory, you should replace the following string:
 
3. Edit <u>config.php</u> file adjusting '''$xcart_web_dir''' parameter. If your cart was installed in the "store" directory, you should replace the following string:
  
<source>
+
<pre>
 
$xcart_web_dir ="/store";
 
$xcart_web_dir ="/store";
</source>
+
</pre>
  
 
with this:
 
with this:
  
<source>
+
<pre>
 
$xcart_web_dir ="";
 
$xcart_web_dir ="";
</source>
+
</pre>
 +
 
 +
{{XC 4.2}}
  
4. If you have enabled clean urls in your .htaccess file
+
4. If you are using X-Cart version 4.2-4.4 and you have enabled clean urls in your .htaccess file, find the following lines in the file:
  
 
<pre>
 
<pre>
Line 33: Line 37:
 
</IfModule>
 
</IfModule>
 
# /Clean URLs ]]]
 
# /Clean URLs ]]]
 +
</pre>
  
 +
and replace them with the following:
 +
 +
<pre>
 +
# Clean URLs [[[
 +
Options +FollowSymLinks -MultiViews -Indexes
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /
 +
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
 +
RewriteCond %{REQUEST_URI} !^/server-status
 +
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
 +
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteCond %{REQUEST_FILENAME} !-d
 +
RewriteCond %{REQUEST_FILENAME} !-l
 +
RewriteRule ^(.*)$ dispatcher.php [L]
 +
</IfModule>
 +
# /Clean URLs ]]]
 +
</pre>
 +
 +
{{XC 4.4}}
 +
 +
5. If you are using X-Cart 4.4.x and you have enabled CSS and JavaScript optimization tools in your .htaccess file, find the following lines in the file:
 +
 +
<pre>
 +
# Speed-Up JS and CSS [[[
 +
Options +FollowSymLinks -MultiViews -Indexes
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /xcart/
 +
RewriteRule loader_(.+).css loader.php?type=css&md5_suffix=$1 [L]
 +
RewriteRule loader_(.+).js loader.php?type=js&md5_suffix=$1 [L]
 +
</IfModule>
 +
# /Speed-Up JS and CSS ]]]
 +
</pre>
 +
 +
and replace them with the following:
 +
 +
<pre>
 +
# Speed-Up JS and CSS [[[
 +
Options +FollowSymLinks -MultiViews -Indexes
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /
 +
RewriteRule loader_(.+).css loader.php?type=css&md5_suffix=$1 [L]
 +
RewriteRule loader_(.+).js loader.php?type=js&md5_suffix=$1 [L]
 +
</IfModule>
 +
# /Speed-Up JS and CSS ]]]
 +
</pre>
 +
 +
6. If you have enabled clean urls in your .htaccess file
 +
 +
<pre>
 +
# Clean URLs [[[
 +
Options +FollowSymLinks -MultiViews -Indexes
 +
<IfModule mod_rewrite.c>
 +
RewriteEngine On
 +
RewriteBase /store/
 +
RewriteCond %{REQUEST_URI} !^/xcart/(payment|admin|provider|partner)/
 +
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
 +
RewriteCond %{REQUEST_FILENAME} !-f
 +
RewriteCond %{REQUEST_FILENAME} !-d
 +
RewriteCond %{REQUEST_FILENAME} !-l
 +
RewriteRule ^(.*)$ dispatcher.php [L]
 +
</IfModule>
 +
# /Clean URLs ]]]
 
</pre>
 
</pre>
  
Line 45: Line 115:
 
RewriteBase /
 
RewriteBase /
 
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
 
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
 +
RewriteCond %{REQUEST_URI} !^/server-status
 
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
 
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
 
RewriteCond %{REQUEST_FILENAME} !-f
 
RewriteCond %{REQUEST_FILENAME} !-f
Line 56: Line 127:
 
5. Check if X-Cart is working fine on the new location.
 
5. Check if X-Cart is working fine on the new location.
  
6. Move products and category images back to the filesystem if necessary.
+
6. Move images from the database back to the filesystem if necessary.
  
 
[[Category:X-Cart user manual]]
 
[[Category:X-Cart user manual]]

Revision as of 19:53, 18 April 2017

Here are general instructions on how to move your cart to the web-root directory:

X-Cart 4.0or earlier

1. If you are using X-Cart 4.0.19 or earlier, make sure your product and category images are stored in the database. If they are stored on the filesystem, you should temporarily move them to the database. You can do this under the "Images location" section of the admin interface.

2. Move all files from the directory where X-Cart installed to the root web directory. You can do this using either FTP or (better) SSH access. File permissions must be preserved during the copying, otherwise you will need to adjust the permissions manually.

3. Edit config.php file adjusting $xcart_web_dir parameter. If your cart was installed in the "store" directory, you should replace the following string:

$xcart_web_dir ="/store";

with this:

$xcart_web_dir ="";
X-Cart 4.2or above

4. If you are using X-Cart version 4.2-4.4 and you have enabled clean urls in your .htaccess file, find the following lines in the file:

# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xcart/
RewriteCond %{REQUEST_URI} !^/xcart/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]

and replace them with the following:

# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_URI} !^/server-status
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]
X-Cart 4.4or above

5. If you are using X-Cart 4.4.x and you have enabled CSS and JavaScript optimization tools in your .htaccess file, find the following lines in the file:

# Speed-Up JS and CSS [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xcart/
RewriteRule loader_(.+).css loader.php?type=css&md5_suffix=$1 [L]
RewriteRule loader_(.+).js loader.php?type=js&md5_suffix=$1 [L]
</IfModule>
# /Speed-Up JS and CSS ]]]

and replace them with the following:

# Speed-Up JS and CSS [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule loader_(.+).css loader.php?type=css&md5_suffix=$1 [L]
RewriteRule loader_(.+).js loader.php?type=js&md5_suffix=$1 [L]
</IfModule>
# /Speed-Up JS and CSS ]]]

6. If you have enabled clean urls in your .htaccess file

# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /store/
RewriteCond %{REQUEST_URI} !^/xcart/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]

you have to go in and change those as well

# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_URI} !^/server-status
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]

5. Check if X-Cart is working fine on the new location.

6. Move images from the database back to the filesystem if necessary.