|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
Wordpress Permalinks Not WorkingIf we're using Apache, there are 2 ways to fix this: 1. Allow Wordpress to edit an .htaccess file in the WP root directory. 2. Add a Directory section to the domain's Virtual Host block. The .htaccess MethodUsing this method, Wordpress needs to have permission to edit the .htaccess file in the root-Wordpress directory: Create a blank .htaccess file: cd /web/vhosts/example.com/htdocs/
touch .htaccess Make Apache read the .htaccess file. Edit the conf file for the target domain: vi /etc/httpd/vhosts/example.com Add a Directory directive:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
<Directory /web/vhosts/example.com/htdocs/>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
Virtual Host DirectiveUsing this method, we can just add all of the necessary directives in the Virtual Host block in the Apache config file:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /web/vhosts/example.com/htdocs
<Directory /web/vhosts/example.com/htdocs/>
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Directory>
</VirtualHost>
|
|
|
|
|