简体   繁体   English

URL重写,URL屏蔽

[英]URL rewriting, url masking

I want to know if there is a solution to rewrite url from http://domain.com/username to http://username.domain.com ? 我想知道是否存在将URL从http://domain.com/username重写为http://username.domain.com的解决方案?

Also I want to mention, that this should be done automatically, when a new user registers. 我还要提及的是,当新用户注册时,此操作应自动完成。

I am using laravel 5 framework by the way. 我正在使用laravel 5框架。

Please check solutions below 请检查下面的解决方案

Using .Htaccess 使用.htaccess

Read Solution at http://laravel.io/forum/03-11-2014-routing-for-subdomain 阅读位于http://laravel.io/forum/03-11-2014-routing-for-subdomain的解决方案

Using Laravel Controllers 使用Laravel控制器

Read at http://laravel-tricks.com/tricks/dynamic-subdomain-routing https://laracasts.com/discuss/channels/general-discussion/routing-for-optional-subdomain-domain-and-optional-tld?page=1 请阅读http://laravel-tricks.com/tricks/dynamic-subdomain-routing https://laracasts.com/discuss/channels/general-discussion/routing-for-optional-subdomain-domain-and-optional-tld ?page = 1

You will need to understand Laravel Basic Routing first. 您将需要首先了解Laravel基本路由。 Read Laravel Documentation at 阅读以下网址的Laravel文档

https://laravel.com/docs/5.1/routing https://laravel.com/docs/5.1/routing

Hope this will help you. 希望这会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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