I am keen to understand how I might be able to do the following.
A list of products or things that might be a JSON data object or flat text file of things.
Let's say the list of things is:
twitter
facebook
instagram
I want to get a URL system that does this:
domain/advice-on-twitter
domain/advice-on-facebook
domain/advice-on-instagram
where twitter
or facebook
is the variable and I want domain/advice-on-<random string>
to 404.
So I am seeing how to make a slug cause a template to load according to the template but I don't want to create a whole page in the backend with a slug.
So I want to make a dynamic page creation idea. The variable will be used with php to build content that is unique and render that per page.
I don't think there is much that can be done with .htaccess
for this problem.
I want to get the string from the URL in PHP and therefore build my content.
I just need to get a page-template PHP file to load where I can start my PHP work.
Hope this makes sense.
Thank you for any pointers as it is a loaded question to a degree.
I am keen to understand how I might be able to do the following.
A list of products or things that might be a JSON data object or flat text file of things.
Let's say the list of things is:
twitter
facebook
instagram
I want to get a URL system that does this:
domain/advice-on-twitter
domain/advice-on-facebook
domain/advice-on-instagram
where twitter
or facebook
is the variable and I want domain/advice-on-<random string>
to 404.
So I am seeing how to make a slug cause a template to load according to the template but I don't want to create a whole page in the backend with a slug.
So I want to make a dynamic page creation idea. The variable will be used with php to build content that is unique and render that per page.
I don't think there is much that can be done with .htaccess
for this problem.
I want to get the string from the URL in PHP and therefore build my content.
I just need to get a page-template PHP file to load where I can start my PHP work.
Hope this makes sense.
Thank you for any pointers as it is a loaded question to a degree.
Share Improve this question edited Jan 12, 2017 at 18:35 gmazzap 46.3k6 gold badges95 silver badges147 bronze badges asked Jan 12, 2017 at 18:20 landedlanded 1316 bronze badges1 Answer
Reset to default 1I would actually tackle it with the .htaccess
file, using RewriteCond
and RewriteRule
, something like:
RewriteCond %{REQUEST_URI} ^/advice-on-(\[a-zA-z])$
RewriteRule ^/?(.*) http://domain/customadvice?advice=$1 [L]
Note that the Regex in the parenthesis will be reused as $1
in the RewriteRule
.
You should then have a WordPress page on /customadvice
and use the $_GET
attribute from the page template for whatever use you need.
The path /advice-on
should still give a 404.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744697278a4588570.html
评论列表(0条)