Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install WordPress in its own directory but permalink fails

I installed WordPress on EC2, located in /var/www/html/wordpress. I followed the WordPress guide to copy index.php and .htaccess to root which is /var/www/html, and modified index.php and setting in admin panel. It works pretty well if I stick to only default link, such as: http://www.cubcanfly.com/?p=5, however other permalink options fails, actually all of the permalink options.

My .htaccess is

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

in /etc/httpd/conf/httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

is NOT commented.

Thanks in advance

like image 220
HooYao Avatar asked Jul 16 '11 05:07

HooYao


People also ask

Why does permalink not work in WordPress?

The simplest way to deal with this problem is by resetting the permalinks structure: Login to your WordPress Dashboard. Go to Settings > Permalinks. Select an alternative permalinks structure -> Save Changes.

Can I install WordPress in a subdirectory?

There are no special requirements to install WordPress in a subdirectory. If you already have a WordPress website in the root domain name, then you are good to go. However, if you have a static (non-WordPress website), then you may need to check with your hosting company to find out if they support WordPress.

Where is WordPress install directory?

Usually this directory is called /public_html/. On the other hand, If you want to install WordPress in a subfolder (like example.com/blog), then upload it in a folder /public_html/blog/. Once you are done uploading WordPress, go to your hosting control panel to create a database.


1 Answers

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.

like image 107
HooYao Avatar answered Nov 15 '22 12:11

HooYao