301 redirect through PHP in Wordpress

by pro101 3 replies
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.
#programming #301 #php #redirect #wordpress
Avatar of Unregistered
Avatar of Unregistered

Trending Topics