SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URL Redirect help.

    I recently changed my site url from

    sitename.com/doc/articles/4962/1/What-goes-up-doesnt-have-to-come-down/Page1.html

    sitename.com/doc/articles/4962/what-goes-up-doesnt-have-to-come-down.html

    the 4962 is contentid, articles and 1 just foldernames.

    Can you please tell me what should i put in my htaccess redirect so that all old urls are 301 redirected to the new format.

    i tried as follows

    RedirectMatch 301 /articles/(.*)/1/(.*) http://www.sitename.com/articles/$1

    But this only redirects to doc/articles/4962

    and Google is showing this as 418 error.

    Help plz.

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,129
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pooja18_4u View Post
    i tried as follows

    RedirectMatch 301 /articles/(.*)/1/(.*) http://www.sitename.com/articles/$1

    But this only redirects to doc/articles/4962

    and Google is showing this as 418 error.

    Help plz.
    Well you were close, but you failed to use your second capture which is important.

    Code:
    RedirectMatch 301 /articles/(.*)/1/(.*)/(.*).html http://www.sitename.com/articles/$1/$2.html

  3. #3
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you so much. it worked.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •