Title: Remove Setcookie for Header
Last modified: August 21, 2016

---

# Remove Setcookie for Header

 *  Resolved [ericrw](https://wordpress.org/support/users/ericrw/)
 * (@ericrw)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/)
 * 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)

 *  [Endlyss](https://wordpress.org/support/users/akel-res/)
 * (@akel-res)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/#post-4406436)
 * 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)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/#post-4406443)
 * > 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](https://wordpress.org/support/users/ericrw/)
 * (@ericrw)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/#post-4406463)
 * [@endlyss](https://wordpress.org/support/users/endlyss/)
    Thanks for the ideas
   so far. I don’t have WP Super Cache.
 * [@samuel](https://wordpress.org/support/users/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](https://wordpress.org/support/users/ericrw/)
 * (@ericrw)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/#post-4406467)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [ericrw](https://wordpress.org/support/users/ericrw/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/remove-setcookie-for-header/#post-4406467)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
