htaccess 301 for entire folder and contents

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
LVL 1
jblayneyAsked:
Who is Participating?
 
MurfurConnect With a Mentor Full Stack DeveloperCommented:
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
 
MurfurFull Stack DeveloperCommented:
RewriteEngine On
RewriteRule ^blog/?(.*) /$1 [R=301, L]

Open in new window

0
 
jblayneyAuthor Commented:
Will this conflict with the existing Wordpress rewrite?
0
 
jblayneyAuthor Commented:
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
 
jblayneyAuthor Commented:
actually, 301 redirects do not work at all
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.

All Courses

From novice to tech pro — start learning today.