• Resolved ericrw

    (@ericrw)


    Hi, I was fooling around with the header.php file and placed this code in:

    <?php
    setcookie('nomobile', 'true');
       header('Location: http://yourwebsite.com');
    ?>

    Now the index page continues to redirect to the mobile site even on desktops. I removed the code and it isn’t going back to how it was originally even after clearing cookies/ cache.

    Does this php change other files? How can I remove this and prevent it from happening?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Seems like it should’ve gone back to normal after you deleted it.
    Do you have WP-Super-Cache installed (it comes default with a couple hosting providers, and is automatically activated upon install)? If so, you’ll need to delete that cache as well. (would be under settings -> WP Super Cache -> Easy tab -> Delete Cache

    Moderator Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    I removed the code and it isn’t going back to how it was originally even after clearing cookies/ cache.

    Many people are often surprised to discover that redirects are cached too.

    You say you cleared cache. Did you clear cache, then restart the browser completely? Did you try an “Empty Cache and Hard Reload” if you’re using Chrome?

    “Clearing cache” is something that most people are not doing, even when they think they are. There is more than one kind of cache, and clearing the disk cache doesn’t also clear memory caching in most browsers.

    Thread Starter ericrw

    (@ericrw)

    @endlyss
    Thanks for the ideas so far. I don’t have WP Super Cache.

    @samuel Wood
    I’ve tried multiple browsers with the route you suggested and even different computers which never accessed the site before, but it still continues to redirect to the mobile site.

    Thread Starter ericrw

    (@ericrw)

    Never mind guys, I feel like a total idiot. Apparently I accidentally uploaded the mobile index.html file to the main directory.

    I don’t know how I did that.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Remove Setcookie for Header’ is closed to new replies.