WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to change post number of ?p=1232 (14 posts)

  1. markw89
    Member
    Posted 2 years ago #

    I am creating new posts, but I want to edit post URL
    so for a post wordpress is giving me domain.com/?p=10
    i want to make it domain.com/?p=1132

    Its because I have an old website that i need to recover, google have all these pages indexed with these urls, but I dont have it's files, so I want to be able to edit ?p=number

    Is that possible?

  2. themes
    Member
    Posted 2 years ago #

    it is impossible
    because WP set p="Number" number is your post number. so if you post number is 10 you cant set it to 1132.
    you can change you post link or set it when write post, only if you change your WP permalinks settings from default to any other

    Its because I have an old website that i need to recover, google have all these pages indexed with these urls, but I dont have it's files, so I want to be able to edit ?p=number

    if dont want to lose google old indexed page trust you can set in .htacces file on you old website 301 redirect to you new website with new pages

    hope I help you

  3. markw89
    Member
    Posted 2 years ago #

    thank you themes,
    i just re-created the post, it's url was originally domain/?p=1343
    new post's url is domain/?p=10

    so what I did is redirect original url to the new one using a wordpress plugin, will that be search engine friendly?

  4. themes
    Member
    Posted 2 years ago #

    If you want to redirect one page to another page, add the following code to the .htaccess file in your old site root folder, on a single line.

    redirect 301 /old-file-name.htm http://www.yournewdomain.com/new-file-name.htm

    -----------------------------------------
    If you want to redirect all pages of an entire site to the main page of another domain

    RedirectMatch 301 (.*) http://www.yournewdomain.com/

    yes it will be SE frendly. when a SE bot come to your old page address it will be redirected to new. and 301 redirect tell them that page moved to new adress
    if you wont to know more search in google "redirect 301"

  5. markw89
    Member
    Posted 2 years ago #

    Themes, it's only one website and only one domain name, i just lost my files but I have the content.
    I am redirecting page by page
    so:
    domain/?p=1032 < old url of a post called try this

    redirects to: domain/try-this
    domain/try-this < this is where the same post, new url is on now

  6. themes
    Member
    Posted 2 years ago #

    if you have content, do you have your old site mysql base backup? if so just restore backup to new base, this will resolve all you problem.

  7. markw89
    Member
    Posted 2 years ago #

    yes i have the content, but anything else than that (design, mysql database) and everything else is lost..

  8. phpzag
    Member
    Posted 2 years ago #

    Dear except .htaccess redirection. no ways to solve your problems.

  9. themes
    Member
    Posted 2 years ago #

    ok, it should work

    example-

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^p=1032
    RewriteRule ^ /try-this/? [R=301,L]

    this will redirect your page youdomain.com/?p=1032
    to new URL youdomain.com/try-this/

    so if you want to redirect another page youdomain.com/?p=26 to a new page on you site just add to .htaccess else 2 lines

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^p=1032
    RewriteRule ^ /try-first/? [R=301,L]
    
    RewriteCond %{QUERY_STRING} ^p=26
    RewriteRule ^ /try-second/? [R=301,L]

    i try it right now on my server with wp engine.

    I hope I helped you

  10. reza19
    Member
    Posted 2 years ago #

    u can use this code in post 10
    <meta http-equiv="refresh" content="0;url=domain.com/?p=1132">
    but your editor must be html mode;
    if user see domain.com/?p=10 redirected to domain.com/?p=1132 .

  11. themes
    Member
    Posted 2 years ago #

    reza19
    meta refresh is not SE friendly

    Google will show the URL of the original page in the search results if it has a higher PageRank than the location of the destination page.

    and you can get penalty from google if you use meta refresh , because it old spam technique used for redirect to an other page on other domain.
    meta refresh must be used only to refresh content

  12. markw89
    Member
    Posted 2 years ago #

    So I should solve it using .htaccess redirection?
    There are many many pages, will that be ok with .htaccess to have so many lines?

  13. themes
    Member
    Posted 2 years ago #

    So I should solve it using .htaccess redirection?

    Yes.

    There are many many pages, will that be ok with .htaccess to have so many lines?

    it will be ok.

    but there is a possibility to add in htaccess only few code lines and any old page will be redirected to a new page.
    But to make this happen, all your new page links should have a template based on old page url.

    in your case if old page was like youdomain.com/?p=1032 but new youdomain.com/new-file/ we cant make any relation between old and new, so you need to write in .htaccess line by line rule for any post you want to be redirected and redirect SE trust from old url to new. redirect 301 tell SE that page moved to new address permanently.

  14. markw89
    Member
    Posted 2 years ago #

    Great, thank you so much guys.
    Special thanks to themes :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.