Need help for 301 redirect

New to mod_rewrite? This is a good place to start.

Need help for 301 redirect

Postby katika » Tue Jul 01, 2008 3:24 pm

Hi everyone,

I hope I can get help from you rewrite experts.

1. I have old site (not Wordpress) with link structures

Code: Select all
http://example.com/article.php/post.htm

Code: Select all
http://example.com/category.php/Category


and I want to move content on Wordpress and do 301 redirecton and get like:

Code: Select all
http://example.com/category/post.htm

Code: Select all
http://example.com/category/name-of-category


Permalink structure in wordpress is set to /%category%/%postname%.htm

2. Is it better (for SEO) or not to have .htm extension for post links?

3. Is there any option to put that rewrite code out of .htaccess cause everytime when I update permalink code is gone, and must manually edit ... or to change some core file and added redirection code will stay after permalink update .

4. When I can remove those redeirected codes... when Google will satisfied?


thanks
katika
 
Posts: 3
Joined: Tue Jul 01, 2008 3:00 pm

Postby richardk » Tue Jul 01, 2008 4:13 pm

1. I have old site (not Wordpress) with link structures
Code: Select all
http://example.com/article.php/post.htm

Code: Select all
http://example.com/category.php/Category

and I want to move content on Wordpress and do 301 redirecton and get like:
Code: Select all
http://example.com/category/post.htm

Code: Select all
http://example.com/category/name-of-category


Permalink structure in wordpress is set to /%category%/%postname%.htm

Does this /category/post.htm change?

2. Is it better (for SEO) or not to have .htm extension for post links?

I don't know for sure, but i doubt it matters.

3. Is there any option to put that rewrite code out of .htaccess cause everytime when I update permalink code is gone, and must manually edit ... or to change some core file and added redirection code will stay after permalink update .

This post might help you with that.

4. When I can remove those redeirected codes... when Google will satisfied?

I don't know that either. But i guess when people stop linking to the old URLs.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby katika » Tue Jul 01, 2008 4:36 pm

Thank richardk foe Quick answer

Does this /category/post.htm change?


Yes Category name will change.

If you want I can PM you live link sites.
katika
 
Posts: 3
Joined: Tue Jul 01, 2008 3:00 pm

Postby richardk » Wed Jul 02, 2008 7:15 am

You can only do the redirects individually with a .htaccess file as it cannot guess the category that the post is in.
Code: Select all
Redirect 301 /article.php/post1.htm /category3/post1.htm
Redirect 301 /article.php/post2.htm /category4/post2.htm


If you have access to the httpd.conf file you could use a RewriteMap. Or, you can set up /article.php and /category.php to do the redirect instead of using a .htaccess file.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby katika » Wed Jul 02, 2008 4:08 pm

I tried something like

Code: Select all
RewriteRule ^article.php/(.*)/$ /category_name/(.*)$4 [r=301,nc]


And it is working, do not know how....

Probem is this: old site has about 2500 pages and 150 categories... and what I did ?

I imported content by RSS import tool in Wordpress, category by category, and there are old links pointed to article.php.

Now I can open same page in 2 way with old and new permalink. But I do no is this now duplicated content?

To be honest few days back I researched this rewrite topic and found good solution, but did not saved work :x and after first permalink update in WP all research is gone.

If U have something to add be my gest
katika
 
Posts: 3
Joined: Tue Jul 01, 2008 3:00 pm

Postby richardk » Fri Jul 04, 2008 2:39 pm

Code: Select all
RewriteRule ^article.php/(.*)/$ /category_name/(.*)$4 [r=301,nc]

So category_name does not change?

To be honest few days back I researched this rewrite topic and found good solution, but did not saved work and after first permalink update in WP all research is gone.

I posted this link in a previous post that will help you stop that happening again.

Now I can open same page in 2 way with old and new permalink. But I do no is this now duplicated content?

Two URLs with the same content and no 301 (permanent) redirect? That is duplicate content.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Re: Need help for 301 redirect

Postby katika » Wed Aug 14, 2013 2:24 pm

I am glad that after almost 5 years this forum is still here to help people.

Yes I have one big problem, too. Hope someone clever will help me.

I want to switch my old site to new wordpress with custom post type support. Permanent 301 redirect.

Old permalink structure is:

1. Category and post
http://domain.com/category/post.html

2. Category and subcategory and post
http://domain.com/category/subcategory/post.html

Pretty common, now let see new permalink structure which is crazy (post part):

1. Category link without post
http://domain.com/SOME_CUSTOM_WORD/category/

2. Post permalink
http://domain.com/SOME_CUSTOM_WORD/post.html

I do not know what to do

Now I can not have
http://domain.com/SOME_CUSTOM_WORD/category/post.html

but
http://domain.com/SOME_CUSTOM_WORD/post.html


Crazy custom post types.

I hope someone can help me here again.
Katika
katika
 
Posts: 3
Joined: Tue Jul 01, 2008 3:00 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 13 guests

cron