homepage Welcome to WebmasterWorld Guest from 54.166.148.189
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
301 redirection for moving site to another CMS
How to rewrite URLs to point to new address when moving site to another CMS
Jole




msg:4644728
 9:32 am on Feb 13, 2014 (gmt 0)

I need 301 redirection rule for migrating CMS on site.

On old CMS I have URL structure like this:

I wish is to move my site to another CMS and to have all old (or most) URLs with 301 redirect to new pages.

Category url on old CMS:

www.my-site-name.com/category-name-some-category-suffix/

www.my-site-name.com/category-name-some-category-suffix/page/2/

www.my-site-name.com/category-name-some-category-suffix/subcategory-name-some-category-suffix/

www.my-site-name.com/category-name-some-category-suffix/subcategory-name-some-category-suffix/page/2/

Post urls on old CMS.

www.my-site-name.com/category-name-some-category-suffix/subcategory-name-some-category-suffix/some-post-name.jpg.html

and one add-on page for every post.
Post add-on urls on old CMS.

www.my-site-name.com/full-size/category-name-some-category-suffix/subcategory-name-some-category-suffix/some-post-name.jpg-some-words-here.html

=================


Category url on new CMS:

I have "category_url" as category base (after domain name), also I wish to remove "-some-category-suffix" from category, and subcategory (if any).

For category URLs to:

add "category_url/" after domain name

remove "-some-category-suffix" from category, and any subcategories

to redirect to URL like this:

www.my-site-name.com/category_url/category-name/

www.my-site-name.com/category_url/category-name/page/2/

=================

Post urls on new CMS.

I have for example "category-url" as post base (after domain name). Please note difference between category base "category_url" and post base "category-url".

For post page to:

remove "-some-category-suffix" from category, and any subcategories

rename ".jpg.html**" to ".html**"

to redirect to URL like this:

www.my-site-name.com/category-url/category-name/subcategory-name/some-post-name.html

=================

For post add-on page to:

remove "-some-category-suffix" from category, and any subcategories

rename "full-size" to "category-url"

rename ".jpg-" to ".html-?"

remove ending ".html" (after "-some-words-here")

to redirect to URL like this:

www.my-site-name.com/category-url/category-name/subcategory-name/some-post-name.html-?some-words-here




Summary.

Category from:

www.my-site-name.com/category-name-some-category-suffix/

to:

www.my-site-name.com/category_url/category-name/

Post from:

www.my-site-name.com/category-name-some-category-suffix/subcategory-name-some-category-suffix/some-post-name.jpg.html

to:

www.my-site-name.com/category-url/category-name/subcategory-name/some-post-name.html

Post add-on page from:

www.my-site-name.com/full-size/category-name-some-category-suffix/subcategory-name-some-category-suffix/some-post-name.jpg-some-words-here.html

to:

www.my-site-name.com/category-url/category-name/subcategory-name/some-post-name.html-?some-words-here


Any help would be great, if rewrite rules are not possible for all URL types than please for some of them.



I tried this:


#For post page URLs
RewriteRule ^(.*)-some-category-suffix(.*).jpg.html(.*)$ /category-url/$1$2.html$3 [L,R=301]

#For post add-on page URLs
RewriteRule ^full-size/(.*)-some-category-suffix(.*).jpg-(.*).html(.*)$ category-url/$1$2.html-?$3$4 [L,R=301]

#Category URLs
RewriteRule ^(.*)-some-category-suffix(.*)$ /category_url/$1$2 [L,R=301]


It works, if there is just one category level, it removes just last "-some-category-suffix".

Output examples

For post pages

www.my-site-name.com/category-url/category-name-some-category-suffix/subcategory-name/some-post-name.html

or for post add on page

www.my-site-name.com/category-url/category-name-some-category-suffix/subcategory-name/some-post-name.html-?some-words-here

or for category

www.my-site-name.com/category_url/category-name-some-category-suffix/subcategory-name/


I need little tweak of it to remove all instance of "-some-category-suffix" if more than one in URL.

If you can fix it, that would be nice.

Any advice, help?

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved