0

I want to create or use a script that do this:

if a users click on the bit.ly link then it redirects to my website

to homepage.com/folder1

and if the user delete the string folder1, then he will go to homepage.com

but I want that the users even if he delete folder1 string and go to homepage.com, having cookies in his device,

even if the users redirect to homepage.com, I want that the user still go from homepage.com always to homepage.com/folder1

is that possible?

is that clear?

thank you for your support.

  • It's possible, but what do you mean by folder1? WordPress treats paths a bit differently. Do you have a WordPress site? – Runnick Oct 31 '17 at 13:30
0

As this is A WordPress Specific:

function my_page_template_redirect_cookie() {
    if( is_front_page() && isset($_COOKIE['the_cookie']) ){
        wp_redirect( home_url( '/folder1/' ) );
        die;
    }
}
add_action( 'template_redirect', 'my_page_template_redirect_cookie' );
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.