Raymond Pittman
Raymond Pittman

Reputation: 99

.htaccess rewriting a URL - Change WordPress URL

I'm trying to rewrite my WordPress post's URL which is currently:

http://example.com/posts/titleofpost

to

http://example.com/titleofpost

What am I doing wrong by chance?

RewriteEngine On
RewriteRule   ^posts/(.+)$   title=$1   [L]

I have a feeling that the title=$1 is wrong, and should be some different expression? What could this expression be?

Upvotes: 1

Views: 40

Answers (1)

Latpaw
Latpaw

Reputation: 121

RewriteEngine On
RewriteBase /
RewriteRule   ^posts/(.+)$   $1   [R=301,L]

Upvotes: 3

Related Questions