Reputation: 4050
On the front end of my WordPress 3.5.2 site, I have three buttons: Home, Blog and Sample Page. When my Permalink Settings are set to Default
, I can access these three pages:
Home: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/
Blog: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/?page_id=13
Sample Page:
http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/?page_id=2
However, when I changed my Permalink Settings to Post name
, and refreshed the browser, I cannot access the Blog page and Sample page. I get the following errors:
Blog: http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/blog
Not Found
The requested URL /blog/ was not found on this server.
Sample Page:
http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/sample-page/
Not Found
The requested URL /sample-page/ was not found on this server.
In WordPress's Settings -> Permalink Settings
, I also get this message:
If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.
When I checked my permissions for the .htaccess file, I got 644, so I changed it to 666 and the message disappeared (I changed it back to 644)
[ec2-user@ip-xx-xxx-xxx-xx html]$ ls -l .htaccess
-rw-r--r-- 1 root root 258 Jul 25 21:49 .htaccess
[ec2-user@ip-xx-xxx-xxx-xx html]$ sudo chmod 666 .htaccess
I can still access my home page after changing the permalink settings to Post name
. I'm not sure if this has anything to do with my problem but I installed my WordPress site in a subdirectory (xxx) on my Amazon EC2 micro instance and I changed WP's General Settings as follows:
WordPress Address (URL): http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com/xxx
Site Address (URL): http://ec2-xx-xxx-x-xxx.compute-1.amazonaws.com
Upvotes: 3
Views: 4954
Reputation: 2007
Make a .htaccess file at the root of your Wordpress installation. Then add the following -
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
If you want Wordpress to do it automatically, then change the file permission to 777 using chmod
.
Upvotes: 3
Reputation: 1960
I found this by googling "permalinks htaccess amazon ec2", it might help: http://guiem.info/permalinks-on-wordpress-amazon-ec2/
Upvotes: 5