Reputation: 1121
I'm trying to add a .htaccess
file so Wordpress can use a custom permalink.
I've added the following script to my root
, which is located in /web
:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Although I've added the .htaccess
file with this to the root
, it still doesn't seem to work.
Am I missing something out?
Upvotes: 0
Views: 64
Reputation: 308
Looks like you are missing the last RewriteRule and closing tag.
RewriteRule . /index.php [L] and the closing </IfModule>
tag.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Once you have added this in, go to the permalinks page in the admin area. Loading this page will refresh your permalinks. After that you should be all set.
Upvotes: 0
Reputation: 11
The one that we use on our site looks like this:
# 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>
# END WordPress
The BEGIN and END WordPress look like comments to me, but maybe they are needed by someone along the way. Also, on our site, the .htaccess is permissions 644 (chmod 644 .htaccess) and is owned by apache. Hope that helps.
Upvotes: 0
Reputation:
Here is a checklist for you
mod_rewrite
is enabledselinux
is configuredAllowOverride
is set to All
in httpd.conf
Upvotes: 1