Pergunta

I'm trying to move a silverstripe site from one host server to a new one. However, I kept getting a 404 error on the site, and log error [Wed May 07 15:20:10 2014] [error] [client xxx.xx.xx.xxx] File does not exist: /home/examplesite/public_html/sys_cpanel, referer: http://xxx.xx.xx.xxx/~examplesite/.

The site is using silverstripe 2.4.5, everything works fine on the old server. The new hosting company is using a numbered preview link eg http://xxx.xx.xx.xxx/~examplesite/ for you to make sure the site is working before you close the live site. Can someone please point me to the right direction? Thanks.

Here is what I've done: 1. moved all ftp file to the new server 2. migrated database 3. make a database connection through _config.php in mysite folder 4. altered .htaccess

Here is the .htaccess file which I commented out the first line because it is pointing to the live site, I also tried to put the preview address in (http://xxx.xx.xx.xxx/~examplesite/) which didn't work either.

###RewriteRule mambo/ http://www.examplesite.com/ [R=301,L] ###
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$) 
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_URI} /assets/Uploads/members/ANZJAT [NC]
RewriteCond %{REQUEST_FILENAME} \.(pdf|zip|rar|7z|doc|docx|xls|xlsx|ppt|pptx)$ [NC]
RewriteRule .* filedownloadpermission?file=%{REQUEST_FILENAME}&%{QUERY_STRING} [L,NC]

</IfModule>

### SILVERSTRIPE END ###

Here is _config.php in mysite folder, I tried to changed it to dev rather than live which didn't work either.

 <?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
    "type" => "MySQLDatabase",
    "server" => "servername", 
    "username" => "admin", 
    "password" => "xxxxxxx", 
    "database" => "examplesite_database",
);

MySQLDatabase::set_connection_charset('utf8');

Director::set_dev_servers(array(
    'localhost',
    '127.0.0.1',
));

Director::set_environment_type("live");
SSViewer::set_theme('themename');
Email::setAdminEmail('info@examplesite.com');

Geoip::$default_country_code = "countryname";
DataObject::add_extension('Member', 'MemberExtension');
DataObject::add_extension('SiteConfig', 'CustomSiteConfig');
Security::set_default_login_dest('members');
SortableDataObject::add_sortable_class('EventSession');
SortableDataObject::add_sortable_class('ClientType');
define('NON_MEMBER_TYPE', 'non-member');
Director::AddRules(100, array('filedownloadpermission/$Action/$ID/$OtherID' => 'FileDownloadPermission_controller'));
?>

Any help would be appreciated, thanks.

Foi útil?

Solução

change RewriteBase / to RewriteBase /~examplesite. Just revert this after the site goes live as it's only whilst you're trying to view the site via http://xx.xx.xx.xx/~examplesite/

Thanks.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top