Solved

htaccess 301 for entire folder and contents

Posted on 2013-10-22
5
299 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
ID: 39591532
RewriteEngine On
RewriteRule ^blog/?(.*) /$1 [R=301, L]

Open in new window

0
 
LVL 1

Author Comment

by:jblayney
ID: 39591635
Will this conflict with the existing Wordpress rewrite?
0
 
LVL 11

Accepted Solution

by:
Murfur earned 500 total points
ID: 39591717
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
ID: 39608999
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
ID: 39609010
actually, 301 redirects do not work at all
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

773 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