Install WordPress in its own directory but permalink fails
Finally I find the problem. It's the AllowOverride option in httpd.conf which is located in /etc/httpd/conf/httpd.conf, "sudo find / -name httpd.conf -print" can easily find it.I changed any AllowOverride NONE->ALL where i can find in the file. It just worked,even without doing any change to .htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]</IfModule>
This .htaccess works on my host in which wordpress is installed in its own directory.
Thank you @adlawson @Will, without you, I couldn't find the problem.
http://codex.wordpress.org/Using_Permalinks this official guide is quite enough to use permalink even wordpress is installed in a sub directory.
Have a look at this post How does RewriteBase work in .htaccess
You need to change RewriteBase /
to RewriteBase /wordpress
I did not need to edit RewriteBase in .htaccess.The problem really is in httpd configuration for EC2 machines.
My .htaccess -
<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule>
In /etc/httpd/conf/httpd.conf -
<Directory /> Options FollowSymLinks AllowOverride All</Directory># AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# Options FileInfo AuthConfig Limit#AllowOverride All