mod rewrite in htaccess file not working
Excerpts from my httpd.conf file
LoadModule rewrite_module modules/mod_rewrite.so
AllowOverride All
AccessFileName .htaccess
With those settings it seems like the Apache config looks good, so here is the .htaccess file:
# BEGIN WordPress
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule>
# END WordPress
I appreciate any help that anyone might have. Thanks!!!
4 Replies
# BEGIN WordPress
<ifmodule rewrite_module="">RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule>
# END WordPress
and
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@cyphun:
Thanks for the reply, but that is working for me either I guess you mean it does not work for you.
Ok then, keep with the latter (without IfModule) and post your error. If it is 404, 403 or something like that, you have error in your rule (denied access to index.php or missing file). If it is 50x, you have a syntax error or not loaded module.
Also try if your .htaccess is working properly - try to deny or allow access to all and see if something changes.
You do not write which distro you use but is it possible you don't have rewrite module at all (no .so file) or it isn't in specified directory?
Don't forget to check /var/log/apache/error_log to see if there isn't any clue.
Second, the issue was with my apache configuration. Although I had AllowOverride All set near the area of the config file that talks about htaccess, that wasn't the right spot. I needed to also set the the AllowOverride All within the
<directory>Options FollowSymLinks
AllowOverride All</directory>
Lastly for anyone having issues with the format of the actual htaccess file this is what I ultimately ended with in my htaccess file:
# BEGIN WordPress
<ifmodule rewrite_module="">RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule>
# END WordPress