Wordpress styles and admin not working after transferring site from local to AWS

Viewed 183

I just transferred my wordpress blog from localhost to aws(amazon webservices)

the method i followed

1.database copy phpmyadmin from localhost

2.create database on new server and import sql from old server in the databse of new server

3.set wp config file on new server username,password,databse name

4.set wp-options table on new databse

update siteurl,update home to the website url

5.copy all wp files and make zip file ->move zip file to site location via filezilla ftp and unzipped it in the location

after this the wordpress site loads and all pages and posts work but styles are missing..

here is my functions.php

 function fastinfo_files(){ 
     //css
     //wp_enqueue_style('google-fonts','https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap');
     wp_enqueue_style('google-fonts','https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');
     wp_enqueue_style('google-fonts2','https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;800&display=swap');
     wp_enqueue_style('google-fonts3','https://fonts.googleapis.com/css2?family=Oswald:wght@300;400;500&display=swap');
     //wp_enqueue_style('bootstrap',get_stylesheet_uri().'/assets/css/bootstrap.css',array(),'4.0','all');
     wp_enqueue_style('bootstrap',get_template_directory_uri().'/assets/css/bootstrap.css',array(),'4.0','all');
     wp_enqueue_style('font-awesome','https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
     //wp_enqueue_style('font-awesome2','https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css');
     wp_enqueue_style('slick-theme','https://cdn.jsdelivr.net/gh/kenwheeler/slick@1.8.1/slick/slick-theme.css');
     wp_enqueue_style('slick-css','https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css');
     wp_enqueue_style('custom',get_template_directory_uri().'/assets/css/style.css',array(),microtime(),'all');
     wp_enqueue_style('fastinfo_main_styles',get_stylesheet_uri(),array(),microtime());

     //js
     wp_enqueue_script('jquery');
     wp_enqueue_script('boot-popper','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js');
     wp_enqueue_script('boot-js','https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js');
     wp_enqueue_script('fast-main-js',get_template_directory_uri().'./assets/js/main.js',array(),microtime(),true);
     //wp_enqueue_script('fontawesome-js','https://kit.fontawesome.com/a076d05399.js');
     //wp_enqueue_script('slick-js','https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js');
     
         
 } 
 add_action('wp_enqueue_scripts','fastinfo_files');

i even tried commention out enqued css and put css directly in header like this

 <!-- CSS here -->
    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/bootstrap.css">
     <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/style.css">
     <?php wp_head(); ?>
    

but that too didnt work

and moreover i cant access wp-admin every time i try to do so it shows me this error

This page isn’t workingwww.xxxxxxxx.com redirected you too many times. Try clearing your cookies.

i followed the same steps before to mirror wordpress website from local to cpanel hosting and it worked like charm but since i have no idea on aws i am really confused whats wrong..

any help will be highly appreciated thanks

2 Answers

add these lines to your theme's function.php:

update_option( 'siteurl', 'https://example.com' );
update_option( 'home', 'https://example.com' );

then clear your browser's cache and see if it works.

I got this resolved adding the following code in wp-config.php which allowed me to access wp-admin

 $_SERVER['HTTPS'] = 'on';
Related