When the incoming URL is A, it automatically runs to B with a value?

reason
because someone else"s domain name needs to be attached to their own server, but the original path of textual connection is different, it may fail
for example, it is originally http://love.me/12939. The number of articles will be added to my server according to the number of articles, and several types will be added. The network address must be changed to https://love.me/blog/type/sub-type/12939
, but the accreditation of type and sub-type depends on the type specified by the article, for example, abc , prod , it will be changed to https://love.me/blog/abc/prod/12939

.

question

  • is this true in htaccess?
  • how to correctly import type/sub-type? Except for the article ID, everything else has to be changed. LOL

  • first answer the question of URL redirection. From http://A.com to https://B.com, you can first consider modifying the DNS resolution rules to change the original A record (parsing to ip) to 30x/ explicit jump record (different DNS service providers have different names for this kind of record. For example, my Aliyun is called explicit jump, and some are also called URL jump, which are actually 301jump 302 jump). The record value is directly written as https://B.com, and the latter part needs to be thrown to the front of the Web service to deal with
  • .
  • htaccess can handle partial static rewriting of (rewrite) class requirements, such as rewriting A.com/index.html to A.com/index.php , or redirecting A.com/auth5/39/ to A.com/index.php?cat=auth&id=5&num=39 , as long as you add a RewriteEngine on instruction and use the RewriteRule instruction to write the URL to filter and match respectively. But I'm not sure what the rules of your two variables are, so I'm not sure if I can do it by my predecessor. Besides, I'm not familiar with Apache either. )
  • later level can also do Rewrite, for example, I have used the PHP framework Yii corresponding module is urlManager, other frameworks are more or less the same, all write regular.
< hr >

with the same domain name, if the type and sub-type are not fixed, then the rewrite will generally be handed over to the later level to do. The only exception is that your front-level comes with its own logic (such as the Nginx version with Lua extensions), which can be handled directly at the front-level.


< H2 > No < / H2 >

because other people give you less information than you need.
someone only gives you / 12411.html and you need type/sub-type/12411.html if you fail to pass parameters in other ways, it will not be feasible.


I don't think so, because the rewrite rules of Nginx do not support this requirement. Specifically, you can take a look at the rewriting rules of Nginx.

Menu