Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Pass a domain name in the URL
  • Hi,

    I am trying to find the most feasible way to pass a domain name in the url, such as /domains/mydomain.net

    Currently fuel cuts off anything from the . onwards.

    Thank you for any input you can give me regarding this.
  • HarroHarro
    Accepted Answer
    A dot in the URL defines an extension, as defined in the RFC's.

    So officially you should encode data that has a dot in it. Alternativly, you can disable striping the extension in the routing section of the config.php (1.4+).
  • Ahh I see 1.4 has been updated. Thank you for pointing that out.

    Regarding the encoding, what method would you recommend for that?
  • Not easy.

    You can use standard URL encoding, %2E for the dot, but that will be converted by the browser and still seen as an extension.

    Alternatively you can add a 'fake' extension to the URL (http://example.com/domain/mydomain.com.html) so that gets stripped and your parameter survives.

    Or you can use the Input class to fetch the stripped extension, and stick it back on your parameter once you have retrieved in it your controller method.

    A bit of a hack, but a solution if you don't want to disable striping extensions for all URI's.
  • Thank you so much for the detailed response. I appreciate it.

    I think the best method will be upgrading to 1.4 and disabling the config option, since the other methods do seem more hackish. 

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion