Forum Moderators: phranque

Message Too Old, No Replies

301 redirect to wordpress version of site

         

zeus

10:30 am on Jun 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm once again 301 problem, I got a site where I now want to redirect to a wordpress version of that site.

In old version folder where map old is i have placed this redirect


RewriteRule ^old/ http://www.example.com/new/ [R=301,L]

just dont work, i get a 404 in the new wordpress version

lucy24

12:51 pm on Jun 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That "old/" and "new/" is a little bit too generic. Is that meant as an example, where you're redirecting individually page by page? Is there capturing involved? Are they directory names?

Redirecting to Wordpress is tricky because of all the behind-the-scenes rewriting. Does "new/" represent the physical location of the material, or the URL that you want the user to see?

Even if redirects only apply to material in one directory, they should be placed as early as possible. That is, in your config file or the highest-level htaccess that you can use. Don't let requests waste time going to the wrong place. (Analogy: You go all the way to the 5th floor and then find a sign on the door saying that your dentist's office is now on the second floor... of the building across the street. You will be annoyed, and you will wonder why nobody bothered to put up a sign in the front lobby.)

zeus

12:57 pm on Jun 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Folder -> and here is then sub folders with images mostly, but those folders has the names of the pages i want to redirect -> old1 , old2, old3

in url example.com/old1/ i want to redirect that to example.com/new/

with htaccess

zeus

1:41 pm on Jun 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



got it, the 301 placed in front off in root, but that was just not how i did it on another site. I hope this helps others also, thanks lucy.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

g1smd

7:31 pm on Jun 20, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Look for a forum post by jdMorgan on improving the Wordpress htaccess file. There's a lot of things you can do.