I
I
Igor Dyachenko2018-06-06 12:38:28
URL Handling
Igor Dyachenko, 2018-06-06 12:38:28

How to rewrite without a redirect from a subdomain to a domain with the desired route in Yii2?

There is a task! The information site is written in Yii2. There is a location search where you can search for an event like (class, studio, retreat, teacher) in any country or city. When you type in any query, it generates a path like this: mydomain/search/s?location=spain&type=class. It is necessary to bring the link to the CNC view using a subdomain, in this form: spain.mydomain.info/class.
I wrote the following rule in urlManager:
[
'pattern' => ' http://.mydomain.info/ ',
'route' => 'search/s',
],
Created a _wildcard_ in cPanel to dynamically generate subdomains for my domain. I moved this directory to the main directory of my site, correctly indicated the path to it. Everything resolves, but there is no redirection to this address mydomain.info/search/s?location=spain&type=class.
I created an htaccess file in the _wildcard_ folder. where I wrote the rules:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+).mydomain.info$
RewriteRule (.*) http://mydomain.info/s/%1/$1 [L]
But a redirect occurs and the address changes, but I need it to be saved in the address bar: spain.mydomain.info/class
Help please, the deadlines are burning, the customer requires exactly this type of link!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yeletsky, 2014-08-24
@Tiendil

And what did you do this year? Here it is and post it.
The question is too general, the web is different. Do what you would like to do. If you plan to engage in, I don’t know, the development of stores for individual entrepreneurs, then make an example of such a store. If you want to make games, make games.
Again, customers are also different. Some need a beautiful design, while others will look, for example, for contributions to open-source projects. And everyone looks at work experience in years.
Therefore, in any case, I would recommend spending a couple of years working in a team on some complex project, otherwise a year of experience is poof.

N
nokla, 2014-08-25
@nokla

Whatever you believe in, then throw it off, you can even hit other people's layouts, the developer will not be offended :)
A person who loves his job is always glad that his product is used, even if not for its intended purpose.

S
Stac, 2014-08-28
@Stac

The portfolio should have pictures and all sorts of moving terrible things in JS.
This applies poorly to Python, so a portfolio is not necessary to start freelancing.
For example, I don't have one. But I've only been freelancing for 5 years, maybe I'll change my mind and start a portfolio later.
And what is:
1) intelligible, clear and detailed answers to the posted tasks
2) a bunch of sites that I made. I give links to them directly in the answer to the project, so that they are in place ("I have implemented this function that you need so much here ")
3) Several screenshots of the same sites. Appropriate in meaning to the project can be applied to the answer to the project.
In short, customers generally do not understand programming, so they need a description of the solution to their problem and beautiful pictures. If there are no pictures, a description is sufficient.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question