Base URLs IN URL Constructor

351 views
Skip to first unread message

Sebastian Frohm

unread,
Jan 31, 2013, 10:32:14 PM1/31/13
to pha...@googlegroups.com
I was wondering if we could discuss adding in a way to adding a baseUrl to all URLs that are generated. I may have overlooked it, or may just not know how to do it, but I haven't seen a good way to generate fully qualified URLs. The main reason I would like to see them in Phalcon is for SEO reasons. I think it could also make life easier if one were to go between HTTP and HTTPS portions of a site.

What does everyone think?

Sorry if this is a dupe. I haven't seen anything regarding this.

Andres Gutierrez

unread,
Feb 1, 2013, 1:57:00 PM2/1/13
to pha...@googlegroups.com
Hi Sebastian, You can set up a base uri in the URL generator:

$di['url'] = function() {
   $url = new Phalcon\Mvc\Url();
   $url->setBaseUri('http://example.com/');
   return $url;
};

2013/1/31 Sebastian Frohm <sebasti...@gmail.com>
I was wondering if we could discuss adding in a way to adding a baseUrl to all URLs that are generated. I may have overlooked it, or may just not know how to do it, but I haven't seen a good way to generate fully qualified URLs. The main reason I would like to see them in Phalcon is for SEO reasons. I think it could also make life easier if one were to go between HTTP and HTTPS portions of a site.

What does everyone think?

Sorry if this is a dupe. I haven't seen anything regarding this.

--
You received this message because you are subscribed to the Google Groups "Phalcon PHP Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phalcon+u...@googlegroups.com.
To post to this group, send email to pha...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/phalcon/-/VgqPK176RSoJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Sebastian Frohm

unread,
Feb 1, 2013, 1:58:46 PM2/1/13
to pha...@googlegroups.com

Haha look at that! Thanks a lot. Never would've try that.

Reply all
Reply to author
Forward
0 new messages