Passing a parameter to a permalink

admin2025-01-07  4

I'm trying to create permalinks for a page that currently has parameters passed to it. The site was set up by somebody else and I'm not familiar with Wordpress

I have various pages which have URLs of the form /events/single-event/?u_name=<event_name>/ e.g. /events/single-event/?u_name=Hippy

I would like to be able to access these various pages via /<something>/<event_name>/ where I'm not too fussy about what <something> is. <something> can have a slash in it if required.

I've had a go at setting this up via RewriteRule in .htaccess but haven't had any luck.

Can someone suggest how I can achieve this?

Many thanks

I'm trying to create permalinks for a page that currently has parameters passed to it. The site was set up by somebody else and I'm not familiar with Wordpress

I have various pages which have URLs of the form /events/single-event/?u_name=<event_name>/ e.g. /events/single-event/?u_name=Hippy

I would like to be able to access these various pages via /<something>/<event_name>/ where I'm not too fussy about what <something> is. <something> can have a slash in it if required.

I've had a go at setting this up via RewriteRule in .htaccess but haven't had any luck.

Can someone suggest how I can achieve this?

Many thanks

Share Improve this question asked Jun 2, 2016 at 23:29 geojaygeojay 311 bronze badge 1
  • You'll need to look at the link Bruno has provided, and consult that somebody because you'll later need to change $_GET['u_name'] to get_query_var assuming you have the rewrite rules applied. – Ismail Commented Jun 3, 2016 at 1:51
Add a comment  | 

1 Answer 1

Reset to default 0

You don't have to mess with .htaccess since WordPress has it's own rewrite engine builti in. You are looking for this: https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256979a403.html

最新回复(0)