Pages 404 in wordpress

First of all, I am very new to wordpress and know almost nothing about it.

When I create the page foo using in wp-admin, I get the message that the page is created. When I click on view page, it 404s. I’ve followed the steps on http://codex.wordpress.org/Pages#Creating_Pages, but apparently I’m missing something.

Read More

I let WordPress rebuild my .htaccess, but still no luck.

System specifications:

  • Ubuntu 13.04
  • Apache2
  • PHP 5.4.9
  • MySQL 14.14 Distrib 5.5.32

Installed WordPress Plugins:

  • Debug This
  • My own (empty) plugin

.htaccess

# 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

“Debug This” output for query -> rewrite

Current Rewrite

Matched Rule: 
Matched Query: 
Query String: debug-this=rewrites

Rewrite Rules

Rule    Rewrite
dating_user/?$  index.php?post_type=dating_user
dating_user/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?post_type=dating_user&feed=$matches[1]
dating_user/(feed|rdf|rss|rss2|atom)/?$ index.php?post_type=dating_user&feed=$matches[1]
dating_user/page/([0-9]{1,})/?$ index.php?post_type=dating_user&paged=$matches[1]
category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?category_name=$matches[1]&feed=$matches[2]
category/(.+?)/(feed|rdf|rss|rss2|atom)/?$  index.php?category_name=$matches[1]&feed=$matches[2]
category/(.+?)/page/?([0-9]{1,})/?$ index.php?category_name=$matches[1]&paged=$matches[2]
category/(.+?)/?$   index.php?category_name=$matches[1]
tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?tag=$matches[1]&feed=$matches[2]
tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?tag=$matches[1]&feed=$matches[2]
tag/([^/]+)/page/?([0-9]{1,})/?$    index.php?tag=$matches[1]&paged=$matches[2]
tag/([^/]+)/?$  index.php?tag=$matches[1]
type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?post_format=$matches[1]&feed=$matches[2]
type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?post_format=$matches[1]&feed=$matches[2]
type/([^/]+)/page/?([0-9]{1,})/?$   index.php?post_format=$matches[1]&paged=$matches[2]
type/([^/]+)/?$ index.php?post_format=$matches[1]
dating_user/[^/]+/attachment/([^/]+)/?$ index.php?attachment=$matches[1]
dating_user/[^/]+/attachment/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
dating_user/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
dating_user/([^/]+)/trackback/?$    index.php?dating_user=$matches[1]&tb=1
dating_user/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?dating_user=$matches[1]&feed=$matches[2]
dating_user/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?dating_user=$matches[1]&feed=$matches[2]
dating_user/([^/]+)/page/?([0-9]{1,})/?$    index.php?dating_user=$matches[1]&paged=$matches[2]
dating_user/([^/]+)/comment-page-([0-9]{1,})/?$ index.php?dating_user=$matches[1]&cpage=$matches[2]
dating_user/([^/]+)(/[0-9]+)?/?$    index.php?dating_user=$matches[1]&page=$matches[2]
dating_user/[^/]+/([^/]+)/?$    index.php?attachment=$matches[1]
dating_user/[^/]+/([^/]+)/trackback/?$  index.php?attachment=$matches[1]&tb=1
dating_user/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
dating_user/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$   index.php?attachment=$matches[1]&cpage=$matches[2]
gn-genre/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-genre&term=$matches[1]&feed=$matches[2]
gn-genre/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?taxonomy=gn-genre&term=$matches[1]&feed=$matches[2]
gn-genre/([^/]+)/page/?([0-9]{1,})/?$   index.php?taxonomy=gn-genre&term=$matches[1]&paged=$matches[2]
gn-genre/([^/]+)/?$ index.php?taxonomy=gn-genre&term=$matches[1]
gn-location-3/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-3&term=$matches[1]&feed=$matches[2]
gn-location-3/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-3&term=$matches[1]&feed=$matches[2]
gn-location-3/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-3&term=$matches[1]&paged=$matches[2]
gn-location-3/([^/]+)/?$    index.php?taxonomy=gn-location-3&term=$matches[1]
gn-location-2/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-2&term=$matches[1]&feed=$matches[2]
gn-location-2/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-2&term=$matches[1]&feed=$matches[2]
gn-location-2/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-2&term=$matches[1]&paged=$matches[2]
gn-location-2/([^/]+)/?$    index.php?taxonomy=gn-location-2&term=$matches[1]
gn-location-1/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$  index.php?taxonomy=gn-location-1&term=$matches[1]&feed=$matches[2]
gn-location-1/([^/]+)/(feed|rdf|rss|rss2|atom)/?$   index.php?taxonomy=gn-location-1&term=$matches[1]&feed=$matches[2]
gn-location-1/([^/]+)/page/?([0-9]{1,})/?$  index.php?taxonomy=gn-location-1&term=$matches[1]&paged=$matches[2]
gn-location-1/([^/]+)/?$    index.php?taxonomy=gn-location-1&term=$matches[1]
robots.txt$    index.php?robots=1
.*wp-(atom|rdf|rss|rss2|feed|commentsrss2).php$    index.php?feed=old
.*wp-app.php(/.*)?$    index.php?error=403
.*wp-register.php$  index.php?register=true
feed/(feed|rdf|rss|rss2|atom)/?$    index.php?&feed=$matches[1]
(feed|rdf|rss|rss2|atom)/?$ index.php?&feed=$matches[1]
page/?([0-9]{1,})/?$    index.php?&paged=$matches[1]
comments/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?&feed=$matches[1]&withcomments=1
comments/(feed|rdf|rss|rss2|atom)/?$    index.php?&feed=$matches[1]&withcomments=1
search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?s=$matches[1]&feed=$matches[2]
search/(.+)/(feed|rdf|rss|rss2|atom)/?$ index.php?s=$matches[1]&feed=$matches[2]
search/(.+)/page/?([0-9]{1,})/?$    index.php?s=$matches[1]&paged=$matches[2]
search/(.+)/?$  index.php?s=$matches[1]
author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?author_name=$matches[1]&feed=$matches[2]
author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$  index.php?author_name=$matches[1]&feed=$matches[2]
author/([^/]+)/page/?([0-9]{1,})/?$ index.php?author_name=$matches[1]&paged=$matches[2]
author/([^/]+)/?$   index.php?author_name=$matches[1]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]
([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]
([0-9]{4})/([0-9]{1,2})/?$  index.php?year=$matches[1]&monthnum=$matches[2]
([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ index.php?year=$matches[1]&feed=$matches[2]
([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$  index.php?year=$matches[1]&feed=$matches[2]
([0-9]{4})/page/?([0-9]{1,})/?$ index.php?year=$matches[1]&paged=$matches[2]
([0-9]{4})/?$   index.php?year=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$  index.php?attachment=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$    index.php?attachment=$matches[1]&tb=1
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$ index.php?attachment=$matches[1]&cpage=$matches[2]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&cpage=$matches[5]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$   index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$ index.php?attachment=$matches[1]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$    index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]
([0-9]{4})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$ index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]
([0-9]{4})/comment-page-([0-9]{1,})/?$  index.php?year=$matches[1]&cpage=$matches[2]
.?.+?/attachment/([^/]+)/?$ index.php?attachment=$matches[1]
.?.+?/attachment/([^/]+)/trackback/?$   index.php?attachment=$matches[1]&tb=1
.?.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$   index.php?attachment=$matches[1]&feed=$matches[2]
.?.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$    index.php?attachment=$matches[1]&feed=$matches[2]
.?.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$    index.php?attachment=$matches[1]&cpage=$matches[2]
(.?.+?)/trackback/?$    index.php?pagename=$matches[1]&tb=1
(.?.+?)/feed/(feed|rdf|rss|rss2|atom)/?$    index.php?pagename=$matches[1]&feed=$matches[2]
(.?.+?)/(feed|rdf|rss|rss2|atom)/?$ index.php?pagename=$matches[1]&feed=$matches[2]
(.?.+?)/page/?([0-9]{1,})/?$    index.php?pagename=$matches[1]&paged=$matches[2]
(.?.+?)/comment-page-([0-9]{1,})/?$ index.php?pagename=$matches[1]&cpage=$matches[2]
(.?.+?)(/[0-9]+)?/?$    index.php?pagename=$matches[1]&page=$matches[2]

I also verified that Apache’s mod_rewrite module is installed and enabled.

apache2.conf (comments removed):

LockFile ${APACHE_LOCK_DIR}/accept.lock

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_event_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess

<Files ~ "^.ht">
    Order allow,deny
    Deny from all
    Satisfy all
</Files>

DefaultType None


HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

Include mods-enabled/*.load
Include mods-enabled/*.conf

Include ports.conf

LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

Include conf.d/

Include sites-enabled/

Include /etc/phpmyadmin/apache.conf

Related posts

6 comments

  1. Like Manish, I think the issue is with AllowOverride.

    The following is based on a Debian server. Ubuntu, if you are not aware, is based on Debian.

    In your apache2/ directory, you should have a sites-available/ and a sites-enabled/ directory.

    1. Disable your site with a2dissite
    2. Edit the appropriate file in sites-available/ to include the
      AllowOverride directive.
    3. Enable the site with a2ensite.

    The following is based on y entry for my sandbox install of the current WordPress on my dev server:

    # Apache configuration
    
    Alias /wp_release /path/to/site/files
    
    <Directory /path/to/site/files>
        AllowOverride FileInfo
        DirectoryIndex index.php
        Allow from All
        <IfModule mod_php5.c>
            AddType application/x-httpd-php .php
    
            php_flag magic_quotes_gpc Off
            php_flag track_vars On
            php_flag register_globals Off
            php_value include_path .
        </IfModule>
    
    </Directory>
    

    That is from a dev site with no access to the public internet (and I may have twitched something as an experiment at some point along the way). You may not want exactly that on a production server but the key parts are these bits:

        AllowOverride FileInfo
        DirectoryIndex index.php
    

    Reference: http://httpd.apache.org/docs/current/mod/core.html#allowoverride

  2. There are few things you can do about it ..

    1) You can reset the permalink array by going to the permalinks tab in wp-admin and simply re-saving the permalink structure.

    Navigate to: WordPress Dashboard → Settings → Permalinks: Click “Save Changes”.

    2)Next, use a debugger to view the rewrite array and confirm that the rewrite rule responsible for processing your URL is not in place. To do this, install the plugin Debug This, which makes it easy to view what is actually in the WordPress rewrite array.

    Once this plugin is installed and activated, go to your site. Then navigate to:

    Homepage → Admin Bar → Debug This → Query → Rewrites.

    Try this things and let us know what error it gives..

    Also 3rd thing I found that conflicting settings in some SEO plugins created the missing pages problem.

    As your using SEO plugin ..I suggest just deactivate it and check ..

    And as SEO Plugin alternate you can use All In One SEO. It works great, unless the configuration are wrong .

  3. WordPress categorizes posts not pages.

    In any case you are doing things the wrong way round. If you want to create categories go to:

    Appearance > Posts > Categories

    and set them up there. Or use the category manager on the RH side of the Post editor.

  4. First step is to simplify. Disable all the plugins and set your theme back to a default built-in like Twenty Thirteen. Report back with what happens.

    If creating and viewing a page starts working again you know it is a plugin or theme issue. Activate one-at-a-time until you discover which one is breaking functionality.

    If the basic WordPress install and default theme are still not working you have a server configuration or domain/host name configuration issue. Make sure the URL for View Pages is correct and matches what you expect. If not check your general settings in WordPress.

    1. Delete .htaccess file
    2. Go To Setting > Permalinks
    3. Change your Permalinks type to anything else than current one
    4. Save Changes

    That will create new .htaccess, hopefully it will be formatted the way WordPress loves!

  5. What I understand from the above is you have .htaccess file and also correct code written in to the same file but still getting 404 issue.
    Let me tell you why. Your server not allowing .htaccess file to read or override permission.
    So how can you give this permission?
    Open your Apache httpd.conf file serch for AllowOverride now you can see it is present several times. check for below comment in to the same file:

     # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        #
        AllowOverride None
    

    Just replace AllowOverride None by AllowOverride All

    Now restart APACHE and it should work

Comments are closed.