Hi. I’m here again.
I am trying to put an already existing silverstripe site from online to my local host. I would like to edit some things and I don’t want break something on the online one.
I’ve downloaded all the files and put them on my folder that i called kibs (using wamp).
Then i’ve downloaded the database, created a new one on localhost and uploaded it.
I went on mysite/ and edited the file config.php (global $databaseConfig; variable). I put inside the database details i’ve created on local. When I go on localhost/kibs I have an automatic redirect on the online website.
I tought I could dev/build but i pref not doing it (just because i’m not sure if it can be a problem).
Is possible that i have a redirect url in the database and everytime i try to access it locally, it automatically redirect me on that url? Thanks for help
Is that a 3.x install?
is there a “silverstripe-cache” folder? if so, clear its contents
There shouldn’t be anything in the db for url, unlike wp; you can grep your “mysite” folder or “themes” folder for anything that might have been hardcoded
Hi, i have silverstripe-cache and cleared it but still redirecting me on the online website. On my site i don’t have nothing that could redirect and now i’m checking the theme directory but even there i can’t see nothing for now.
Am wondering if it even hit your own files;
you can try opening developer tools (chrome) > network tools > preserve log
then visiting your localhost and then taking a look at the request flow, to ascertain if it even hits your ss install or if it is redirected beforehand
- If it hits your install (a hint would be something like a 301 redirect), then you can try with breakpoints in your _config.php, and later in your Page.php (or HomePage.php) to determine where it is causing
- If it doesnt hit, then it might
a. htaccess redirection
b. your own computer’s host file pointing to the server’s ip
Have a look at https://docs.silverstripe.org/en/3/getting_started/environment_management/ and pay particular attention to the bit about $_FILE_TO_URL_MAPPING
. In addition, check your codebase for anywhere you might have hardcoded your production URL.
The problem is that I don’t have any _ss_environment file… I think i should re build the website because who did it just changed a lot of stuff in without writing down any instructions (or comments).
Thank you anyway!
@CW_Chong: I checked and i don’t get any 301. Checked the htaccess too. Can’t really understand this.
Thanks anyway!
Actually wait, i checked the wrong httaccess…
I have this but when i clean the redirect function it gaves me a internal server error.
What should i change?
### SILVERSTRIPE START ###
Deny access to templates (but allow from localhost)
php_value date.timezone ‘Europe/Rome’
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
Deny access to IIS configuration
Order deny,allow
Deny from all
Deny access to YAML configuration files which might include sensitive information
<Files *.yml>
Order allow,deny
Deny from all
Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
DirectoryIndex disabled
</IfModule>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteCond %{HTTP_HOST} ^kibsstudio.com [NC]
RewriteRule ^(.*)$ http://www.kibsstudio.com/$1 [R=301,NC,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.kibsstudio.com/$1 [R,L]
RewriteBase '/'
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Deny access to potentially sensitive files and folders
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
# Process through SilverStripe if no file with the requested name exists.
# Pass through the original path as a query parameter, and retain the existing parameters.
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_URI} !^/landing*
RewriteCond %{REQUEST_URI} !^/demobot*
RewriteCond %{REQUEST_URI} !^/tmp*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* framework/main.php?url=%1 [QSA]
EXPIRES CACHING
ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType text/html "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 1 month" ## EXPIRES CACHING ##SILVERSTRIPE END
php_flag log_errors on
php_value error_log /home/u902781820/public_html/error_log.txt
DO NOT REMOVE THIS LINE AND THE LINES BELOW SSL_REDIRECT:kibsstudio.com
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (www.)?kibsstudio.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
DO NOT REMOVE THIS LINE AND THE LINES ABOVE SSL_REDIRECT:kibsstudio.com
Hi. I solved this problem.
The .htaccess file had those rewrite rules:
RewriteCond %{HTTP_HOST} ^kibsstudio.com [NC]
RewriteRule ^(.*)$ http://www.kibsstudio.com/$1 [R=301,NC,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.kibsstudio.com/$1 [R,L]
I just deleted the rewrite rule. After that I had problems viewing the site in local, and then I realized that because the SS version was 3, i had to change my PHP version on Wamp. Now is working and i can work on it.
Thanks to who helped me!
That was really valuable. Also, I had a query, I run my own digital marketing agency. Initially I designed this website on wordpress but now I am thinking to migrate it from Wp to Silverstripe CMS. How can I do so? Do let me know. Here is the website https://www.facelessdigital.com/