James Watt
James Watt

Reputation: 5

wordpress url rewrite help needed

I have a wordpress site and has template page. I am passing class ID as cid parameter. http://www.example.com/class-details/?cid=51

I want it to have like http://www.example.com/class-details/

I wrote rule below in .htaccess RewriteRule ^class-details/?([^/]*)$ example.com/class-details/$1 [NC,R,L]

It leads to recursive redirection. I tried checking wordpress redirect API a lot. but no luck. Please guide me for this.

Upvotes: 0

Views: 60

Answers (2)

chandan singh
chandan singh

Reputation: 1

try this

<rule enabled="true" match-type="wildcard"> 
    <from casesensitive="true">/class-details/cid=([a-zA-Z0-9]+)$</from>
    <to type="passthrough">/class-details?cid=$1</to>
</rule>

Upvotes: -1

Jenish Mandalia
Jenish Mandalia

Reputation: 131

Better to create custom post type, then you don't need to pass the cid or anything and you will have Rewrite URL.

Upvotes: 0

Related Questions