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/r/fe332
Just removing the /:80 will work. The /r/fe332 values are dynamic so a single static route won’t work.
This looks like something that should be solved at the webservice level rather than in CakePHP.
Heres my routes.php so far. It’s not working
Router::redirect(’/:80/r/*’, array(‘controller’=>‘app’,‘action’ => ‘r’), array(‘persist’ => true),301);
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 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.
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?