以编程方式更改网址而无需更改页面内容

时间:2019-04-30 16:10:14

标签: php wordpress

有没有办法在仍然呈现所请求页面的内容的同时,从按单词更改返回的URL?

说我请求/ dogs /,但需要在url末尾附加一个随机字符串,同时仍呈现页面/ dogs /

/ dogs / foobar /仍在显示/ dogs /页面的地方

当前我正在使用以下方法

repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    //jcenter()
    mavenCentral()
    maven { url "https://plugins.gradle.org/m2/" }
    maven { url "http://dist.wso2.org/maven2/" }
    /*
    flatDir {
        dirs 'libs'
    }
    */
}

哪个显示正确的URL,但是由于其重定向,它会尝试查找此URL列出的页面。有没有一种方法即使在更改了URL的情况下也只能呈现/ dogs /页面?

1 个答案:

答案 0 :(得分:-1)

使用本地php函数:

header("Location: http://example.com/myOtherPage.php");
die();

确保使用die(); http://thedailywtf.com/articles/WellIntentioned-Destruction

相关问题