简体   繁体   English

将index.php重定向到子目录中的特定WordPress页面,但隐藏页面URL

[英]Redirecting index.php to specific WordPress page in subdirectory but hide page url

I'm trying to redirect index.php (or default main domain page) to an specific WordPress page in the subdirectory of the same domain. 我正在尝试将index.php(或默认的主域页面)重定向到同一域的子目录中的特定WordPress页面。 But at the same time Hide the WordPress page's URL path (not show on the browser's address bar). 但是同时隐藏WordPress页面的URL路径(不显示在浏览器的地址栏上)。

For example when users go to mywebsite.com it will redirect to mywebsite.com/WPsite/WPpage (NOT default WordPress home page). 例如,当用户访问mywebsite.com时,它将重定向到mywebsite.com/WPsite/WPpage (不是默认的WordPress主页)。 But the address bar will say mywebsite.com 但是地址栏会显示mywebsite.com

I'm using this on my .htaccess for the redirection 我在.htaccess上使用它进行重定向

RedirectMatch 301 ^/$ /WPsite/WPpage/

But I need to HIDE the "WPsite/WPpage/" part. 但是我需要隐藏“ WPsite / WPpage /”部分。

It doesn't have to be the .htaccess route only, if there's a php function that I can use in the index.php file that's fine too. 如果有一个我可以在index.php文件中使用的php函数,那也不必只是.htaccess路由。

Thanks in advance. 提前致谢。

如果要替换特定目录的索引目录,请将其放在主目录.htaccess文件中:

DirectoryIndex   path/to/your/page.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM