Jafo
Jafo

Reputation: 1331

Mod_rewrite last part of url only

I have a url:

http://www.mysite.com/forum/topic/1234

I need to rewrite this to:

http://www.mysite.com/forum/topic/1234-this-is-a-test

Here is what I have:

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /forum/

RewriteRule ^topic/([0-9]+)$ topic/$1-this-is-a-test [L]
</IfModule>

Nothing happens. Any ideas?

Upvotes: 1

Views: 452

Answers (1)

anubhava
anubhava

Reputation: 784898

You almost got it right, just add R flag:

RewriteRule ^topic/([0-9]+)/?$ topic/$1-this-is-a-test [L,R]

Upvotes: 1

Related Questions