Many people and wordpress developer want to remove the blog or category wordpress from URL. This is really good for seo also. Many times wordpress developer got requirement to remove the blog or category word from wordpress url.
In this tutorial I will let you know how can you easily achieve this requirement. There is two way to achieve this requirement. You can use the .htaccess file for fulfill this requirement.
Note: Apache mod_rewrite rule is must enable to with your Apache web server.
Open your .htaccess file which is present in your root folder of web hosting server. If not then create this file put it.
You can use the permanent redirect rewrite apache rule to achieve this. open your .htaccess file put following lines in that file
RewriteEngine On RewriteBase / #This rewrite rule we added for removing the category wordpress from URL RewriteRule ^category/(.+)$ http://www.wordpressapi.com/files/$1 [R=301,L] #This rewrite rule we added for removing the blog word wordpress from URL RewriteRule ^blog/(.+)$ http://www.wordpressapi.com/files/$1 [R=301,L]
You can achieve this by changing in the code also. Use the following code do this changes. Open your theme folder and functions.php file and put following code in that file.
function remove_blog_word($without_blog_word_permalink)
{
if(!preg_match("/^\/blog\//",$without_blog_word_permalink))
return $without_blog_word_permalink;
$new_permalink=preg_replace ("/^\/blog\//","/",$without_blog_word_permalink );
return $new_permalink;
}
function remove_category_word($without_category_word_permalink)
{
if(!preg_match("/^\/category\//",$without_category_word_permalink))
return $without_blog_word_permalink;
$new_permalink=preg_replace ("/^\/category\//","/",$without_category_word_permalink );
return $new_permalink;
}
add_filter("pre_update_option_permalink_structure","remove_blog_word");
add_filter("pre_update_option_permalink_structure","remove_category_word");
Just put above lines in your functions.php file and that will solve your issue.





I tried your solution you posted and I got
Parse error: syntax error, unexpected '}' in /home/content/n/e/r/nerec/html/wp-content/themes/lifestyle/functions.php on line 75
I removed your code and it did no good. Now my site is screwed..
Great information! I’ve been looking for something like this for a while now. Thanks!
Thanks for best news!
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, iwspo.net
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, iwspo.net
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian,Earn Free Vouchers / Cash
Just want to say what a great blog you got here!
I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian,Earn Free Vouchers / Cash
good !
Really good sharing this.
Tried the .htaccess rewrite rules.
It is working but no content can be found now.
Do both bits of code need implementing together?
Remember that the new WordPress 3.1 has changed the file that needs editing. Here’s a post that explains the new process: http://www.nelsonpires.com/wordpress/remove-word-category-from-wordpress-urls/
Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader
Great read. Thanks for the info!
Awesome post. I so good to see someone taking the time to share this information
This post makes a lot of sense !
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.
Great read. Thanks for the info!
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.