admin管理员组文章数量:1394076
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.
本文标签: Dynamic URL generates dynamic content
版权声明:本文标题:Dynamic URL generates dynamic content 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744697277a2620356.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论