1

I host two wordpress on AWS EC2 (say site1 and site2). The site1 works perfectly, but the site2 can only access the homepage, for other pages, encountering the following error:

Not Found

The requested URL /just-for-test/ was not found on this server.


Apache/2.4.7 (Ubuntu) Server at site2.com Port 80

Both of two sites have the same permission. The site2 configure file /etc/apache2/sites-available/site2.conf is as follows:

<VirtualHost *:80> ServerAdmin [email protected] ServerName site2.com ServerAlias www.site2.com DocumentRoot /var/www/site2.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 

The content of /etc/hosts is as follows:

127.0.0.1 localhost #this is for site1.com, 000-default.conf xx.xx.xx.xx site2.com 

BTW, while accessing http://site2.com/wp-content/uploads/, everything is normal.

Index of /wp-content/uploads

Name Last modified Size Description

Parent Directory -

2015/ 2015-05-24 00:17 -

Apache/2.4.7 (Ubuntu) Server at site2.com Port 80

How to fix it?

2
  • 1
    Have you enabled the htaccess file via the Apache config and/or set up WP Permalinks in the Apache config? Commented Jun 8, 2015 at 21:00
  • @kittykittybangbang There is no .htaccess under site2. I copy .htaccess from site1 to site2 and it works. Commented Jun 9, 2015 at 13:11

2 Answers 2

2

With the help of @Giles Hunt and @kittykittybangbang, I add .htaccess to my website whose content is as follows:

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

And now it works.

Sign up to request clarification or add additional context in comments.

Comments

1

Check your htaccess files on each site and check that mod_rewrite is configured correctly for both sites.

1 Comment

You got the point. There is no .htaccess under site2. I copy .htaccess from site1 to site2 and it works.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.