admin管理员组文章数量:1122832
I'm trying to implement forward and masking of a url. I have a page hosted on vercel as mynewpage.vercel.app. The rest of my page are hosted on Wordpress on myotherpages. I want for when the user types in myotherpages/newpage or navigates there from the nav bar for them to be forwarded to mynewpage.verce.app, but have the url in the address appear as myotherpages/newpage. I'm using the divi theme for all the other pages.
So far I've installed a file manager plugin to get access to the htaccess file. I added this to the file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myotherpages\$ [NC]
RewriteCond %{REQUEST_URI} ^/myotherpages/newpage/?$
RewriteRule ^myotherpages/newpage/?$ / [P,L]
</IfModule>
<IfModule mod_proxy.c>
ProxyPass /myotherpages/newpage
ProxyPassReverse /myotherpages/newpage
</IfModule>
I've also tried adding this
# BEGIN Custom Redirect and Masking
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/myotherpages/newpage$
RewriteRule ^/myotherpages/newpage$ [R=302,L]
# END Custom Redirect and Masking
And this to the functions.php file in the theme/divi etc folder
function custom_redirect_my_new_page() {
if (is_page('myotherpages/newpage')) {
wp_redirect('');
exit();
}
}
add_action('template_redirect', 'custom_redirect_my_new_page');
本文标签: redirectForward and mask implementation not working
版权声明:本文标题:redirect - Forward and mask implementation not working, 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303395a1931870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论