简体   繁体   中英

Link From Subdomain to Root Domain Laravel 4.2

I have 1 subdomain in my app: admin.test.com and then the root is test.com . While in admin.test.com I want to send an email to a user to log in to test.com/login/aseqgaasd but right now it is sending the link to admin.test.com/login/aseqgaasd .

How can I use the {{ URL::to('login', array($code)) }} method to route to the main domain and not the sub domain?

I do not want to use .htaccess

You could use named routes. For example, in your routes.php:

Route::get('login/{param}', array('as' => 'TestLogin', 'uses' => 'HomeController@login'));

Then, in your Blade template:

{{ URL::route('TestLogin', array('param' => $code)) }}

I don't know what your routes file looks like, so you would need to adjust this to fit your needs. The important piece is the 'as' => 'TestLogin' since that's what names the route and allows it to be referred to as such throughout your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM