首页 > 解决方案 > Make a page with a parameter same as a page without parameter

问题描述

I am trying to make this page:

https://mediastreet.ie/media-jobs/role-65678

same as this page using htaccess:

https://mediastreet.ie/media-jobs/role

So basically /role-65678 is a parameter like role-{parameter}. So when on /role-65678 i have a script that fetches this (65678) and displays the job according to it.

标签: php.htaccessurl-rewriting

解决方案


我建议不要编辑您的 htaccess 文件,而是建议使用一个好的旧 get 方法。

使用https://mediastreet.ie/media-jobs/role?id=65678

然后在“role”目录下的index.php文件中,使用如下图的get功能。 <?PHP $id = $_GET["id"]; //Code to follow ?>

过去的经验告诉我,这将节省很多 htaccess 头痛!

一切顺利。


推荐阅读