Jump to content

Deleted Site


jbringolf

Recommended Posts

Web site was hacked and all files deleted. Have backups of some files product images, etc. Database is intact. But when I reinstall and point to the database I get 404 page not found on files which appear to be catagories like store/jewelery.html and products like store/cct-flag.html - is there any way to rebuild these files?

Link to comment
Share on other sites

For URLs that have this syntax, it is the job of the .htaccess file to rewrite them into a form useable by CubeCart.

If the .htaccess file isn't being automatically created/updated to what CubeCart needs (latest few versions do this automatically), then I think you may be restoring a version that is older than it should be.

To fix the .htaccess file, make sure it has these contents:

##### START CubeCart .htaccess #####

## File Security
<FilesMatch "\.(htaccess)$">
 Order Allow,Deny
 Deny from all
</FilesMatch>

#### Apache directory listing rules ####
DirectoryIndex index.php index.htm index.html
IndexIgnore *

#### Rewrite rules for SEO functionality ####
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /    ### Set to the actual folder CubeCart is in, such as /store/, or just / if in the root folder
  
  ######## START v4 SEO URL BACKWARD COMPATIBILITY ########
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule cat_([0-9]+)(\.[a-z]{3,4})?(.*)$ index.php?_a=category&cat_id=$1&%1 [NC]

  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule prod_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]

  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule info_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=document&doc_id=$1&%1 [NC]

  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule tell_([0-9]+)(\.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]

  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule _saleItems(\.[a-z]+)?(\?.*)?$ index.php?_a=saleitems&%1 [NC,L]
  ######## END v4 SEO URL BACKWARD COMPATIBILITY ########

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)\.html?$ index.php?seo_path=$1 [L,QSA]
</IfModule>

## Default store 404 page
ErrorDocument 404 /index.php     ### Make sure to use the actual path
## Override default 404 error document for missing page resources ##
<FilesMatch "\.(gif|jpe?g|png|ico|css|js|svg)$">
  ErrorDocument 404 "<html></html>
</FilesMatch>

##### END CubeCart .htaccess #####

There are two places to be aware of. The examples you gave have a /store/ prefix, so be sure to have that in the .htaccess file where indicated.

Link to comment
Share on other sites

Before we get too far, what is the exact version of CubeCart that you restored? You can determine this by examining the file ini.inc.php. Halway down you will find a statement mentioning the version number.

In the .htaccess file, the statement near the end says to use CubeCart's index.php as the actual document to send back to the browser in case of a real 404.

CubeCart's 404 page (only available in the latest few versions) looks like a regular CubeCart page but the main content simply says 404 - File not found.

Versions older than that does in fact tell the web browser to send a simple 404 status, which your browser then shows you what it has for 404 responses.

Anyway, for the Mod Rewrite and everything else in the .htaccess file to work, the web server needs to be configured to AllowOverride. I can't help you with configuring the web server.

Can you get the main page, index.php?

If so, and the 404s are coming from these specially formed seo-friendly URLs, then your web server isn't letting the rewrite directives be executed.

Link to comment
Share on other sites

Other than going through each product's Edit Product pages and reattaching the image(s) to each one, other processes will be very tricky.

[  Product  ] <== [Image Index] ==> [FileManager]
|product_id |     |product_id |     |file_id    |
                  |file_id    |

The Image Index database table allows for any number of products to use any number of images.

So, the tricky part is to determine if any of your products now have different product_id values, and determine if any of your images now have different file_id values (in the Filemanager database table).

Hopefully, the Product's product_id values have not changed, otherwise, all manner of mayhem will ensue.

However, if the Image's in the /source/ directory has been adequately restored, then you should be able to restore the database tables CubeCart_filemanager and CubeCart_image_index from a backup.

On the other hand, if you don't have a database backup from which you can get these tables restored, then manually rebuilding the Image Index table will be somewhat tedious.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...