Title: WP Permalinks Problem
Last modified: August 19, 2016

---

# WP Permalinks Problem

 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/)
 * Hi,
 * I’ve installed WP at the root of my domain, in an attempt to use it as a CMS.
 * My blog will actually be located at /blog, but I installed it at the root because
   I want to show some recent posts on my root index.php
 * 1. So basically I created a category “blog” in my WordPress install, and all 
   posts are posted here so they appear at mysite.com/blog
 * 2. I then changed permalink structure to:
 * /%category%/%postname%/
 * So all posts appear at mysite.com/blog/post-name/
 * 3. But there is a problem, on the blog homepage (mysite.com/blog) (which is actually
   category.php) I get a 404 error when clicking the “older entries” button.
 * However if doing this at (mysite.com/category/blog) it works.
 * But I just want mysite.com/blog not mysite.com/category/blog!!

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301780)
 * Okay.
 * You should move your blog to /blog instead.
 * 1) Move WordPress to it’s own directory – [http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
   
   2) Get rid of the blog category. 3) Have a beer (or soda, whatever)
 *  Thread Starter [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301794)
 * Hi, Ipstenu,
 * I wanted WordPress installed at the root because then I could have WP loops on
   my root homepage say, and i’d have some WP pages like about-us which would not
   be in the /blog/
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301825)
 * You do know that if you put your blog in a subfolder, you can still have it act
   as if it’s in root? Read the link. You’ll see. It works. You can even further
   customize with a static front page, so the layout of that page is totally different
   than the blog.
 * As for why you’re getting url.com/category/blog …. your category should never
   be the ‘main’ page for your blog.
 * 1) Move WordPress to it’s own directory – [http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory](http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
   
   2) Change your permalinks to `blog/%postname%` 3) Get rid of the category ‘blog’,
   you won’t need it. 4) Customize your front page – [http://codex.wordpress.org/Creating_a_Static_Front_Page](http://codex.wordpress.org/Creating_a_Static_Front_Page)
 *  Thread Starter [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301826)
 * Hm, I’ve managed to sort the problem, pagination now works for mysite.com/blog..
   the fix, courtesy of themadhat.com:
 * 1) In wp-includes/category-template.php search for the following line of code:
 * `$catlink = get_option('home') . user_trailingslashit($catlink, 'category');`
 * Just below that, insert the following:
 * `$catlink = str_replace('/category', "", $catlink);`
 * 2) In wp-includes/classes.php search for the following block of code:
 *     ```
       if ( isset($error) )
       $this->query_vars['error'] = $error;
       ```
   
 * Just below that, insert the following:
 *     ```
       if (@$this->query_vars["name"] == "page")
       {
       $tmp_ar = $this->query_vars;
       $this->query_vars = array();
       $this->query_vars["paged"] = str_replace("/", "", $tmp_ar["page"]);
       $this->query_vars["category_name"] = $tmp_ar["category_name"];
       }
       ```
   
 * Source: [themadhat.com](http://www.themadhat.com/blogging/remove-category-base-wordpress/)
 * Any idea why this fixes it, I don’t like editing core files, because the problem
   is just going to come up again when I update WP?
 * EDIT: I am reading through your most recent reply now!
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301829)
 * Yeah, editing core is always a bad idea 🙂
 * IMO, it’s better to ‘start over’ and get the layout in a normal way working, 
   and then customize the links. You should be able to do all this pretty simply.
 * Just don’t move your blog to the ‘blog’ folder (do ‘wordpress’ or something).
 *  Thread Starter [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301851)
 * My bad I moved the core files to a folder called blog first but i’ve changed 
   it now to a folder called wordpress. Would it matter at all what this folder 
   was called, it’s not used for anything is it, apart from the wp-admin login link?
 * Also I just re-named the category blog to something random, it wouldn’t let me
   delete it because there has to be 1 category it seems. The cat name doesn’t matter
   anyhow since it’s not being used right?
 * Right, I just have 1 problem, I’ve already got my own index.php in my themes 
   folder which has it’s own stuff going on, to act as my homepage (mysite.com),
   this works.
 * But now how do I get my recent posts to show up at mysite.com/blog, what would
   the file be called (i’ve got the code i already had it in my category.php, just
   need to know how to show it at mysite.com/blog)?
 * mysite.com/blog currently shows a 404!
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301869)
 * > Would it matter at all what this folder was called, it’s not used for anything
   > is it, apart from the wp-admin login link?
 * It could conflict if you have a virtual and physical folder named the same. Links
   might go weird.
 * > mysite.com/blog currently shows a 404!
 * This probably means you didn’t update the blog right when you moved it.
 * Add these two lines to the `wp-config.php` file in blog, immediately after the
   initial `<?php` line.
 *     ```
       update_option('siteurl','http://example.com/blog');
       update_option('home','http://example.com/blog');
       ```
   
 * Use your own URL instead of example.com, obviously.
 *  Thread Starter [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301937)
 * Thanks I managed to sort it using
    [http://codex.wordpress.org/Creating_a_Static_Front_Page](http://codex.wordpress.org/Creating_a_Static_Front_Page)
 * Thanks a lot for understanding my problem, as I know my explanations were pretty
   poor, but I guess I can finally move onto point 3 of your first-post and have
   that beer 🙂
 * As a side-note you don’t know if I can just remove categories altogether do you?
   
   I try to post without selecting any cat selected but it just selects one for 
   me automatically when I post..
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301968)
 * You have to have at least one category for WP, IIRC. Probably a holdover from
   the old days when we didn’t use tags.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘WP Permalinks Problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 2 participants
 * Last reply from: [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * Last activity: [16 years, 6 months ago](https://wordpress.org/support/topic/wp-permalinks-problem/#post-1301968)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
