How can I add a port to a URL when accessing the /admin/ controller. |
[eluser]jim-_-[/eluser]
I have a website that is cached with something called Varnish what this has done is make the Admin area very annoying to deal with as the caching disrupts login and so on, however if I add a specific port to the domain it will bypass Varnish. What I can't figure out is how I can make CodeIgniter choose Domain.com ![]() ![]() TL ![]() PS: Its probably possible to but I don't want to do this in Varnish since I want all changes done in the PHP code.
[eluser]meigwilym[/eluser]
If you have a MY_Admin_Controller (or similar) try this in the __construct(). Code: $uri = parse_url($_SERVER['PATH_INFO']); But check that the server provides PATH_INFO correctly first. Mei
[eluser]CroNiX[/eluser]
I'd create some new url helpers like: admin_url() and admin_anchor(). They just need to do an rtrim(base_url(), '/') to remove the slash from the original url and then append ":port/" to it, so your admin_url() would become: http://yoursite.com:8088/ Then use those to generate your links. OR, you could probably just do this with rewrite in .htaccess by detecting if the request string started with "admin/".
[eluser]jim-_-[/eluser]
Thank you both, I was hoping for something like setting a .htaccess rule but in CI somehow (I r noob) so I wouldn't need to rewrite the the admin controller too much, also since things might change. I'm going to read more about how to do it with .htaccess. Edit for googlabillity: I found it was easier to do it in varnish after not finding any .htaccess script for my exact issue. Code: sub vcl_recv { |
Welcome Guest, Not a member yet? Register Sign In |