Solved

htaccess 301 for entire folder and contents

Posted on 2013-10-22
5
295 Views
Last Modified: 2013-10-29
Hello,

Should be simple, but I can't find with google searches.

I want to redirect all the content (pages, images) from my wordpress blog that used to be in the "Blog" folder into the main directory

Redirect 301 /blog/*wild card of any content and folders* http://www.darkstarmedia.net/*wild card of any content and folders*

I am building a new site and eliminating the blog folder, the whole site will be wordpress now
0
Comment
Question by:jblayney
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Murfur
Comment Utility
RewriteEngine On
RewriteRule ^blog/?(.*) /$1 [R=301, L]

Open in new window

0
 
LVL 1

Author Comment

by:jblayney
Comment Utility
Will this conflict with the existing Wordpress rewrite?
0
 
LVL 11

Accepted Solution

by:
Murfur earned 500 total points
Comment Utility
Put it as the first rule so that it processes before any other wordpress specific rewrite
Should look something like this:

RewriteEngine On
RewriteBase /
RewriteRule ^blog/?(.*) /$1 [R=301]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Open in new window


Also remember to update your 'WordPress Address' in General Settings
0
 
LVL 1

Author Comment

by:jblayney
Comment Utility
Hello,

On further testing, this is not working, I am starting to get google webmaster tools errors for URLs starting with /blog/

When i test "/blog/category/graphic-design-2/" for exmaple it gives me  a 404 instead or redirecting me
0
 
LVL 1

Author Comment

by:jblayney
Comment Utility
actually, 301 redirects do not work at all
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now