Newcastlefan
Newcastlefan

Reputation: 39

URL Rewriteing from dynamic links

I'm not sure how to re-write a dynamic url into another kind of dynamic url?

I'm looking to change:

/blog/category.php?catseourl=ExampleCat&pn=1
/blog/category.php?catseourl=ExampleCat&pn=2
/blog/category.php?catseourl=ExampleCatTwo&pn=1

Into:

/blog/category/ExampleCat/1
/blog/category/ExampleCat/2
/blog/category/ExampleCatTwo/1

I've got to this point:

RewriteRule ^blog/category/([^/]*)$ /blog/category.php?catseourl=$1&pn=$1 [L] 

But I'm not sure how to add the dynamic changes into the left hand side of the rewrite?

Thanks for any help.

Upvotes: 0

Views: 52

Answers (3)

Marcelo Rodovalho
Marcelo Rodovalho

Reputation: 923

Try this:

RewriteRule ^blog/category/(.+)/([0-9]+)$ /blog/category.php?catseourl=$1&pn=$2 [L] 

Upvotes: 0

S.Visser
S.Visser

Reputation: 4725

RewriteEngine On
RewriteRule ^blog/category/([^/]*)/([^/]*)/?$ /blog/category.php?catseourl=$1&pn=$2 [L]

Upvotes: 0

Jon Lin
Jon Lin

Reputation: 143876

Try

RewriteRule ^blog/category/([^/]+)/([0-9]+)/?$ /blog/category.php?catseourl=$1&pn=$2 [L] 

Upvotes: 1

Related Questions