# How to fix styles and change wordpress url
## First way
1. After you created elastic IP and associated it with your EC instance you need to restart it and run httpd using ```sudo service httpd restart```
2. Remember your database credentials. If you do not remember open wp-config.php with ```sudo nano /var/www/html/wordpress/wp-config.php``` and find them.
3. Then run the following commands (replace 'username' with your actual DB username; **the same with 'yourip'**):
```
mysql -u username -p
use wordpressdb;
update wp_options set option_value='http://yourip' where option_id in (1, 2);
```
(Note that you could choose different from "wordpressdb" name for the wordpress database; if you do not remember the name use ```show databases;``` in mysql)
4. Exit db and run ```sudo cp -R /var/www/html/wordpress/* /var/www/html```
5. Check the site via ip
6. If everything is ok run ```rm -r /var/www/html/wordpress```
Note that in some cases you can login to admin panel using only http://yourip/wp-login.php (I do not know why)
If the first way does not work try the second one:)
## Second way
1. After you created elastic IP and associated it with your EC instance you need to restart it and run httpd using ```sudo service httpd restart```
2. After that the site will work but the admin page no. Connect to the server via ssh and edit wp-config.php with (change 'yourip' to your elastic IP) ```sudo nano /var/www/html/wordpress/wp-config.php```
Add the following lines there:
```php
define('FS_METHOD', 'direct');
define('WP_HOME', 'http://yourip/wordpress');
define('WP_SITEURL', 'http://yourip/wordpress');
```
3. Restart httpd (просто так, вдруг надо)
4. Run ```sudo chown -R apache:apache /var/www/html```
5. Go to admin panel (http://yourip/wp-admin/) -> Plugins and install Database Browser 
6. Go to Tools -> Database browser -> click "Select table" (on any table; it does not matter) -> click edit query -> insert ```update wp_options set option_value='http://yourip' where option_id in (1, 2);``` and run
7. Connect to server via ssh. Run ```sudo cp -R /var/www/html/wordpress/* /var/www/html```
8. Remove added lines from step 2 (WARNING: the file is now located in /var/www/html/wp-config.php) (you can leave the first one if you need in the future) and restart httpd
9. Check the site by ip
10. If everything is fine run: ```rm -r /var/www/html/wordpress```