• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

remove category from url path

I have a wordpress site and on my post, the url is the following:

http://www.domain.com/category/blog

How would I remove category from that url so that the path is just http://www.domain.com/blog

If not in wordpress, can something be done in Apache?

Also, in wordpress dashboard my permalink is set to /%postname%
0
COwebmaster
Asked:
COwebmaster
5 Solutions
 
ittogoCommented:
You could set up a redirect so that http://www.domain.com/blog redirects to www.domain.com/category/blog.  (http://www.yolinux.com/TUTORIALS/ApacheRedirect.html)

or you could reinstall wordpress in the root of your hosting directory.
0
 
florjanCommented:
You could also move your blog. Instructions are found here: http://codex.wordpress.org/Moving_WordPress
0
 
mjjdesignsCommented:
When viewing the "Category" view of a particular WordPress category, there's no way built into to remove the word "Category" from the URL.

What you can do instead (and I've done many times) is to create a PAGE using a template that outputs all of the posts from a given category, and then setup a redirect from /category/blog to just /blog

It's a bit more work to do, but if you really don't want the word "category" in the URL, that's the best (and actually, the easiest) way to do it.

If you need the actual code to do what I'm describing, let me know.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
COwebmasterAuthor Commented:
mjjdesigns, yes if you have that code, that would be great.
0
 
mjjdesignsCommented:
Bear with me, I'm new at this thing so I may botch the formatting here.

First, in your .htaccess file in the top level directory of your WordPress installation, add this:
 
RedirectMatch 301 ^/category/blog/$ http://www.youriste.com/blog/

Open in new window


Then create a "Blog" Page template, for example:
 
<?php
/*
Template Name: Blog Template
*/
?>
<?php get_header();?>

//Whatever styling you have for your page layout here
    <?php
$wp_query = new WP_Query();
$wp_query->query('cat=INSERTYOURBLOGCATEGORYIDHERE&paged='.$paged.'');
 ?>
    <?php if ($wp_query->have_posts()) : ?>
    <?php 

$i=1;
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
   
        <?php the_content();?>
     
    <?php		 
				 $i++;
				 endwhile;?>
    <?php endif;?>
   //REST OF YOUR PAGE STYLING HERE AFTER CONTENT
  <?php get_sidebar();?>

<?php get_footer();?>

Open in new window


You need to enter the category ID for the "blog" category, as well as add whatever styling you need for the page to look right, as well as for each post's display.

Then just create a new "Page" in WordPress, called "Blog", set the page template as "Blog Page Template" and you should be all set.

If you run into any issues, let me know.
0
 
gwkgCommented:
0
 
COwebmasterAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now