# Redirects working on localhost but not web host

**URL:** <https://discourse.slimframework.com/t/redirects-working-on-localhost-but-not-web-host/66>\
**Category:** Questions\
**Created:** [April 2, 2016, 1:22pm UTC](https://discourse.slimframework.com/t/redirects-working-on-localhost-but-not-web-host/66 "2016-04-02T13:22:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmyclarke01](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jimmyclarke01](https://discourse.slimframework.com/u/jimmyclarke01)\
**Post date:** [April 2, 2016, 1:22pm UTC](https://discourse.slimframework.com/t/redirects-working-on-localhost-but-not-web-host/66/1 "2016-04-02T13:22:27Z")

</div>

Hi, I’m having an unusual issue which I can’t get my head around - and I’d appreciate advice from this community on the best way to debug it.

My site works correctly when run on my local wamp server, but when I upload it to my web host certain redirects don’t work. As an example, at the end of this post route there is a redirect to ‘home’, which is namespaced as ‘home’.

On my local server this redirects correctly and I get my home view with the URL ‘localhost/_websitename_/public’ in the address bar.

However, when run on my webhost it instead just shows a blank browser window with the URL as ‘www._websitename_.com/public/register’

Does anyone know what may be causing this to happen? I’ve tried echoing out the root and var\_dumping the session, but neither has helped me find the cause yet. Any help is much appreciated!

* * *
\<?php use PhD\User\UserPermission; $app-\>get('/register', $guest(), function() use ($app) { $app-\>render('auth/register.php'); })-\>name('register'); $app-\>post('/register', $guest(), function() use ($app) { $request = $app-\>request; $email = $request-\>post('email'); $username = $request-\>post('username'); $password = $request-\>post('password'); $passwordConfirm = $request-\>post('password\_confirm'); $v = $app-\>validation; $v-\>validate(['email' =\> [$email, 'required|email|uniqueEmail'], 'username' =\> [$username, 'required|alnumDash|max(20)|uniqueUsername'], 'password' =\> [$password, 'required|min(6)'], 'password\_confirm' =\> [$passwordConfirm, 'required|matches(password)'] ]); if ($v-\>passes()) { $identifier = $app-\>randomlib-\>generateString(128); $user = $app-\>user-\>create(['email' =\> $email, 'username' =\> $username, 'password' =\> $app-\>hash-\>password($password), 'active' =\> false, 'active\_hash' =\> $app-\>hash-\>hash($identifier),]); $user-\>permissions()-\>create(UserPermission::$defaults); $app-\>mail-\>send('email/auth/registered.php', ['user' =\> $user, 'identifier' =\> $identifier], function($message) use ($user) { $message-\>to($user-\>email); $message-\>subject('Thanks for registering.'); }); $app-\>flash('global', 'You have been registered.'); return $app-\>response-\>redirect($app-\>urlFor('home')); } $app-\>render('auth/register.php', ['errors' =\> $v-\>errors(), 'request' =\> $request]); })-\>name('register.post');

---

<div class="post-metadata">

**Author:** ![danielvaneeden.01](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@danielvaneeden.01](https://discourse.slimframework.com/u/danielvaneeden.01)\
**Post date:** [May 4, 2016, 11:23pm UTC](https://discourse.slimframework.com/t/redirects-working-on-localhost-but-not-web-host/66/2 "2016-05-04T23:23:32Z")

</div>

Hey jimyclarke01 - Make sure there are no blank lines before “\<?php" and REMOVE all "?\>”. Removing all the “?\>” might cause an error or two, in that case add the “?\>” only to the pages giving the error…

It has to do with headers being sent (or not, i think) with the blank lines or the php end. That is why the page remains blank.

Hope this solves the problem.
