# :80 redirect with routes.php

**URL:** <https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252>\
**Category:** Need Help\
**Created:** [September 28, 2016, 6:26am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252 "2016-09-28T06:26:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atti](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@atti](https://discourse.cakephp.org/u/atti)\
**Post date:** [September 28, 2016, 6:26am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252/1 "2016-09-28T06:26:11Z")

</div>

Hi there,  
I’m having a strange redirect issue which i’m unable to solve with routes.php.

Some inbound links to my site have a /:80/ added to the url immediately after the domain. This is catching and connecting to the wrong controllers (error 404).

The Urls i’m trying to redirect are:

[http://mydomain.com/:80/r/fe332](http://mydomain.com/:80/r/fe332) -\> [http://mydomain.com/r/fe332](http://mydomain.com/r/fe332)

Just removing the /:80 will work. The /r/fe332 values are dynamic so a single static route won’t work.

Any ideas?

---

<div class="post-metadata">

**Author:** ![dakota](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dakota/32/1421_2.png) [@dakota](https://discourse.cakephp.org/u/dakota)\
**Post date:** [September 28, 2016, 10:23am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252/2 "2016-09-28T10:23:17Z")

</div>

This looks like something that should be solved at the webservice level rather than in CakePHP.

---

<div class="post-metadata">

**Author:** ![atti](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@atti](https://discourse.cakephp.org/u/atti)\
**Post date:** [October 8, 2016, 6:51am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252/3 "2016-10-08T06:51:49Z")

</div>

Heres my routes.php so far. It’s not working

Router::redirect(’/:80/r/\*’, array(‘controller’=\>‘app’,‘action’ =\> ‘r’), array(‘persist’ =\> true),301);

---

<div class="post-metadata">

**Author:** ![Westy](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/westy/32/409_2.png) [@Westy](https://discourse.cakephp.org/u/Westy)\
**Post date:** [October 10, 2016, 8:42am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252/4 "2016-10-10T08:42:36Z")

</div>

The :80 is the port number (default for non https connections) whats wrong is it should come straight after the domain and not after a forward-slash. Just out of interest you could try [http://mydomain.com:80/r/fe332](http://mydomain.com:80/r/fe332) and see if that works or still gives yo an error. I agree with @dakota you need to look at how this URL is getting created and either fix it there or look at your own redirects make sure your rewrite rules are all correct.

---

<div class="post-metadata">

**Author:** ![atti](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@atti](https://discourse.cakephp.org/u/atti)\
**Post date:** [October 10, 2016, 8:57am UTC](https://discourse.cakephp.org/t/80-redirect-with-routes-php/1252/5 "2016-10-10T08:57:08Z")

</div>

Hi Westy, Thanks for the reply.

I understand the :80 is the port and should come after the domain if it exists at all.  
Unfortunately i’m not in control of the URL that’s being directed to my site as it’s coming from an external sites’ incorrect redirect.

Is there any way I can still salvage the incoming redirect at my end?
