简体   繁体   中英

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. But at the same time Hide the WordPress page's URL path (not show on the browser's address bar).

For example when users go to mywebsite.com it will redirect to mywebsite.com/WPsite/WPpage (NOT default WordPress home page). But the address bar will say mywebsite.com

I'm using this on my .htaccess for the redirection

RedirectMatch 301 ^/$ /WPsite/WPpage/

But I need to HIDE the "WPsite/WPpage/" part.

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.

Thanks in advance.

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

DirectoryIndex   path/to/your/page.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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