• I have a page on my wordpress site https://example.com/location/ that has a bunch of default text. What I want to be able to do is make it so that when a url like https://example.com/location/california/ is entered, it will insert “california” throughout the page. I have a big list of locations, and instead of creating a new wordpress page for each location, I simply want to be able to use the same page template and automatically insert the location name if a user requests it.

    Is there a plugin that allows something like this?

    I have successfully made this work outside of wordpress using .htaccess and a rewriterule:

    .htaccess file:

    RewriteEngine on
    RewriteRule ^location/(.*)/$ /location.php?location=$1

    code for location.php:

    <?php $place = $_REQUEST["location"]; ?>
    <?php echo $place ?>

    So the page the user sees always gets passed the part of the url after location/ but to them it seems like it is a permanent page.

  • The topic ‘Dynamically generated pages in wordpress’ is closed to new replies.