Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When changing the permalink structure on my site, I get a 404 error for every page except the home page. I've see other questions that mention resetting the permalink structure to get it work, but this doesn't work for me (using the default of ?p=123 does show the posts, but changing back to month and name 2012/03/sample-post/ causes the 404).

With the permalink structure set to month and name, the htaccess file is:

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

# END WordPress

The htaccess file that wordpress updates is in the /etc/wordpress directory and the details are:

-rw-r--r-- 1 www-data root      934 2012-03-10 19:13 htaccess

The index.php file is in the /var/www directory:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wordpress/wp-blog-header.php');
?>

Are there other changes I need to make to allow for a change to the permalinks?

Update

This is running on a Linux box I have root access to. I did enable mod_rewrite, but get the same results - the default permalinks work, but changing the structure doesn't. I also have /wordpress in each URL, like wordpress/?page_id=31 and updating the URL in the Wordpress settings doesn't help. That most likely is a separate issue - I'll ask separately, but wanted to provide the info in case it's relevant.

share|improve this question
    
It is very strange that WordPress is updating something in "/etc/" and even stranger that it can update something there. Is this site exposed to the public? –  s_ha_dum Dec 8 '12 at 1:16
    
i got same problem here is the link stackoverflow.com/questions/17183010/… some one help me –  sandeep arron Jun 19 '13 at 7:32
    
@sandeeparron : I am not sure that is the same problem. –  s_ha_dum Oct 20 '13 at 16:50
add comment

4 Answers

In my case:

  1. "AllowOverride FileInfo" instead of "AllowOverride None" for www folder.
  2. Uncomment "LoadModule rewrite_module modules/mod_rewrite.so" (remove "#" symbol).

It works!

share|improve this answer
    
Please explain why this works, or at least why you think it should work. What do your suggestions do? –  s_ha_dum Oct 20 '13 at 16:36
    
Also, the placement of web server files in www/ is server specific, and in this case the files appear to be in the very odd location of /etc/. –  s_ha_dum Oct 20 '13 at 16:40
add comment

Are you wanting the site to render as www.thesite.com/news or www.thesite.com/wordpress/news

If just www.thesite.com/news, try this change:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
share|improve this answer
    
Explain why that could solve the problem. –  toscho Dec 8 '12 at 1:21
add comment

In your question you posted this:

-rw-r--r-- 1 www-data root      934 2012-03-10 19:13 htaccess

Apache looks at a file called .htaccess which is not present in your filesystem.

Rename htaccess -> .htaccess

share|improve this answer
add comment

You need mod_rewrite support on your Server. Make sure your Server supports mod_rewrite and it's enabled. If you've access to the Root of your Server, you can enable mod_rewrite from Apache's httpd.conf file. Open this file in any plain text editor and find following line:

LoadModule rewrite_module modules/mod_rewrite.so

Make sure this line is not commented, that means make sure this line DOES NOT look like this:

#LoadModule rewrite_module modules/mod_rewrite.so

If so, remove the first "#" character and save this file. Restart your Server and try your Permalink again. It should work.

If it still doesn't work for you then it might be due to FrontPage Extensions. Have you installed FrontPage Extensions recently? If so, remove those; I've faced the same issue before and it appeared to be caused by FrontPage Extensions. Once you remove those, go to your Wordpress Admin and disable Permalink (restore it back to ?p=000 structure. Then, delete your .htaccess file from Wordpress (and from the Root as well, if Wordpress is not installed at your Root). Go back to your Wordperss Admin and set new Permalink as you like it to be... see if it works this time.

I hope this information helps. Let us know if either of these solutions helped you to resolve your issue. :-)

Cheers,

Ruturaj.

share|improve this answer
    
Unfortunately, it did not work. I did not have mod_rewrite enabled in the httpd.conf. However, when I did enable it, restart the server, and update the permalink settings, I get the same result - the default works, but not a link with the month/name in the title. I do not have FrontPage extensions. –  Tai Squared Mar 13 '12 at 5:14
    
This is really strange, because mod_rewrite is seen to be the reason for such errors. Did you delete .htaccess? I guess there is something else in your .htaccess file. Please backup your current HTACCESS and delete it; then go to Permalink and set the options to create a new one. If you think deleting HTACCESS is not a good option for you as it may affect other scripts/applications, then you may try commenting out everything else but the rules added by Wordpress. –  Ruturaj Mar 18 '12 at 6:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.