![]() | ![]() | ||||||||
| | #1 |
| Warrior Member Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hi all: I've recently discovered that using /%postname%/ only for permalinks on posts in Wordpress is not scalable. My site has currently a small number of posts (25) and about 35 pages. Likely I will eventually have 100s of posts, so before it's too late it seems I need to change Permalinks. Initially tried to look into htaccess rewrite, but Apache experts said that htaccess can't know postid, so the 301 redirect needs to be done through PHP script. I'm looking into PHP files in wordpress and wondering which file (and line of code) I need to change to accomplish this. Anyone knows what I need to change in wordpress to redirect from: from domain.com/postname to domain.com/postid/postname It would help a lot. Thanks in advance. |
| | |
| | #2 |
| Advanced Warrior War Room Member Join Date: May 2004 Location: Perth, Australia.
Posts: 741
Thanks: 5
Thanked 192 Times in 144 Posts
|
Seeing your list of posts is so small (~25), why don't you just manually hard code the redirects into your .htaccess file right now, and then be done with it? All you will need is a line for each redirect at the top of your .htaccess file that is something like : redirect 301 /some-old-post-title/ http://www.yourdomain.com/123/some-old-post-title/ That should do it.. Take care bruce |
| -------------------------------------------------- Any man who reads too much and uses his own brain too little falls into lazy habits of thinking - Albert Einstein | |
| | |
| | #3 |
| Gleb War Room Member Join Date: Dec 2008 Location: Ottawa, Canada
Posts: 873
Thanks: 11
Thanked 117 Times in 90 Posts
|
Here it goes: WP Admin panel->Settings->Permalinks -> "Custom Structure" = /%post_id%/%postname%/ Although for SEO friendliness I'd suggest using this: /%category%/%postname%/ More info here: Using Permalinks WordPress Codex Regards, Gleb Esman |
| | |
| | |
| | #4 |
| Chief Enthusiasm Officer War Room Member Join Date: Feb 2009 Location: Sheldon, IL
Posts: 30
Thanks: 2
Thanked 3 Times in 3 Posts
|
I used to use the category/postname as mentioned above. I'd like to return to that configuration but have about 200 posts. Is there an easy way/plugin to do a 301 redirect?
|
| | |
| | |
![]() |
|
| Bookmarks |
| Tags |
| 301, php, redirect, wordpress |
| Thread Tools | |
| |
![]() |