0

I have an EC2 instance running Ubuntu hosting a Wordpress site on Apache. I've used LetsEncrypt's CertBot to create an SSL certificate and everything's working fine. I also have direct IP to domain name redirection set up. Now I decided to duplicate the EC2 instance in order to test some changes on a development copy of the site before I push to production. I did that, but accessing the public IPV4 address of the new development site just redirects me to the old production site. I've tried messing with .htaccess as well as /etc/apache2/sites-available/wordpress.conf to remove any redirections or pointers to the old site and replace them with the new correct IPV4 address of the development site but nothing seems to work.

What's the best way to create a duplicate of an EC2 instance that hosts a wordpress site on apache such that I can work on it separately and access it via its public IPV4 normally. I can't "undo" the configuration of the production site that makes it tick. I believe this should be easier that what it seems. My suspicion is that the SSL certificate is causing all the trouble.

Here's the content of /var/www/html/wordpress/.htaccess (before changing)

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^w\.x\.y\.z$
RewriteRule ^(.*)$ https://myexampledomain.com/ [L,R=301]

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I've replaced my domain name.. and replaced the production IPV4 with w.x.y.z.

Here's the content of /etc/apache2/sites-available/wordpress.conf

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/wordpress
ServerName myexampledomain.com
ServerAlias www.myexampledomain.com

<Directory /var/www/html/wordpress/>

Options FollowSymLinks
AllowOverride All
Require all granted

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

RewriteEngine on
RewriteCond %{SERVER_NAME} =myexampledomain.com [OR]
RewriteCond %{SERVER_NAME} =www.myexampledomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Again, I've replaced my domain name.

I'm quite clueless. I want to provide information about my SSL config but I don't know how to do that. I would optimally like to remove/redo the SSL on my development site, and I've tried but somehow dev keeps redirecting to prod it's kind of freaky!

0

You must log in to answer this question.

Browse other questions tagged .