1. <small id='JywIl'></small><noframes id='JywIl'>

      <i id='JywIl'><tr id='JywIl'><dt id='JywIl'><q id='JywIl'><span id='JywIl'><b id='JywIl'><form id='JywIl'><ins id='JywIl'></ins><ul id='JywIl'></ul><sub id='JywIl'></sub></form><legend id='JywIl'></legend><bdo id='JywIl'><pre id='JywIl'><center id='JywIl'></center></pre></bdo></b><th id='JywIl'></th></span></q></dt></tr></i><div id='JywIl'><tfoot id='JywIl'></tfoot><dl id='JywIl'><fieldset id='JywIl'></fieldset></dl></div>
        <bdo id='JywIl'></bdo><ul id='JywIl'></ul>

      1. <legend id='JywIl'><style id='JywIl'><dir id='JywIl'><q id='JywIl'></q></dir></style></legend><tfoot id='JywIl'></tfoot>
      2. htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用

        时间:2023-10-16
        <i id='Lkqb5'><tr id='Lkqb5'><dt id='Lkqb5'><q id='Lkqb5'><span id='Lkqb5'><b id='Lkqb5'><form id='Lkqb5'><ins id='Lkqb5'></ins><ul id='Lkqb5'></ul><sub id='Lkqb5'></sub></form><legend id='Lkqb5'></legend><bdo id='Lkqb5'><pre id='Lkqb5'><center id='Lkqb5'></center></pre></bdo></b><th id='Lkqb5'></th></span></q></dt></tr></i><div id='Lkqb5'><tfoot id='Lkqb5'></tfoot><dl id='Lkqb5'><fieldset id='Lkqb5'></fieldset></dl></div>
      3. <legend id='Lkqb5'><style id='Lkqb5'><dir id='Lkqb5'><q id='Lkqb5'></q></dir></style></legend>
            <tbody id='Lkqb5'></tbody>
        • <small id='Lkqb5'></small><noframes id='Lkqb5'>

            <tfoot id='Lkqb5'></tfoot>
                  <bdo id='Lkqb5'></bdo><ul id='Lkqb5'></ul>
                  本文介绍了htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个类似的问题,已经回答了.然而,答案引出了另一个概念,现在我有以下问题.(用户anubhava"能够回答原始问题.)

                  I had a question similar to this, and it was answered. However, the answer led to another concept and now I have the following question. (User "anubhava" was able to answer the original question.)

                  让我解释一下,我们的情况是这样的:

                  Let me explain, our situation is this:

                  我们正在使用 Joomla 启动一个新网站,但是,我们希望旧网站的所有入站链接继续有效(因为我们在旧网站上的 WordPress 中有很多内容).因此,使用 htaccess,我们能够将所有对主域名的请求重定向到包含新 Joomla 网站的子目录.[例如,由于我们想要的 htaccess 代码,对 www.example.com 的请求被重定向到 www.example.com/PORTALsite.]

                  We are launching a new website using Joomla, however, we wanted all of the old website's in-bound links to continue to function (as we have a lot of content in WordPress on the old website). So, using htaccess, we were able to have all requests to the primary domain name redirect to a sub-directory with the new Joomla website in it. [So as an example, requests for www.example.com get redirected to www.example.com/PORTALsite due to the htaccess code, which is what we want.]

                  此外,此代码还允许对旧 WordPress 网站主页的请求仍然有效(我们正在替换的旧网站).[例如,www.example.com/index.php 仍然可以运行并加载旧的 WordPress 站点,这正是我们想要的.]

                  Further, this code also allows for requests to the Home page of the old WordPress website to still function (the old website we are replacing). [So as an example, www.example.com/index.php will still function and load the old WordPress site, which is what we want.]

                  仅当请求仅针对域名 (www.example.com) 时,它才会重定向到新的 Joomla 网站主页(位于 www.example.com/PORTALsite/),但如果请求是针对旧网站的主页(位于 www.example.com/index.php),它将允许加载旧的 WordPress 网站.

                  Only if the request is for the domain name alone (www.example.com) will it redirect to the new Joomla website's Home page (located at www.example.com/PORTALsite/), but if the request is for the old website's Home page (located at www.example.com/index.php) it will allow this and load the old WordPress website.

                  这是 htaccess 代码:

                  Here's the htaccess code:

                  RewriteEngine on
                  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+[s?]
                  RewriteRule ^$ /PORTALsite [R=301,L]
                  

                  然而,我现在的问题是:有很多入站链接,旧的 WordPress 网站的 index.php 页面被省略,只附加了一个查询字符串(在页面上表示一个页面名称)旧网站通过 WordPress).但是,由于上面的代码将此视为仅对主域名的调用(因为它忽略"了查询字符串),因此它还会将其重定向到新的 Joomla 网站.我们不希望这种情况发生!有什么帮助吗?

                  HOWEVER, my problem now is this: There are many in-bound links where the old WordPress website's index.php page is omitted and only a query string is attached (indicating a Page name on the old website via WordPress). However, because the code above sees this as a call just to the primary domain name alone (as it "ignores" the query string) it also redirects this to the new Joomla website. We do not want this to happen! Any help, please?

                  问题示例:

                  1. (不是问题)请求主域名成功重定向到新的 Jooma 网站,因此 www.example.com 将重定向到www.example.com/PORTALsite,正如我们希望的那样.

                  1. (not a problem) requests for the primary domain name are successfully redirected to the new Jooma website, thus www.example.com will redirect to www.example.com/PORTALsite, as we want and as it should.

                  (不是问题)www.example.com/index.php 成功加载旧的 WordPress网站的主页,正如我们希望的那样.

                  (not a problem) www.example.com/index.php successfully loads the old WordPress website's Home page though, as we want and as it should.

                  然而这是问题:没有文件名但包含一个查询字符串,例如 www.example.com/?page_id=56 也得到重定向到新的 Joomla 网站(例如,www.example.com/PORTALsite/?page_id=56),我们希望这种情况发生.

                  however this is the problem: in-bound links that have no file name but include a query string, such as www.example.com/?page_id=56 are also getting redirected to the new Joomla website (for example, www.example.com/PORTALsite/?page_id=56) AND WE DO NOT WANT THIS TO HAPPEN.

                  我们希望 www.example.com/?page_id=56 重定向到www.example.com/index.php?page_id=56 并从旧的 WordPress 网站.如何根据上面的 htaccess 代码实现这一点?

                  we want www.example.com/?page_id=56 to redirect to www.example.com/index.php?page_id=56 and load the content from the old WordPress site. how do I make this happen based upon the htaccess code above?

                  在此先感谢您的帮助!

                  推荐答案

                  RewriteEngine on
                  # Match requests for /
                  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+[s?]
                  # Don't match requests for page_id=n
                  RewriteCond %{QUERY_STRING} !page_id=[0-9]+
                  # Redirect to /PORTALsite
                  RewriteRule ^$ /PORTALsite [R=301,L]
                  

                  这篇关于htaccess 将根重定向到子目录,但允许根和查询字符串中的 index.php 起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Joomla 包含数据库功能 下一篇:如何将 Joomla 登录会话从一个 joomla 网站共享到一个 ASP.Net MVC 网站

                  相关文章

                  <small id='0nWJY'></small><noframes id='0nWJY'>

                • <legend id='0nWJY'><style id='0nWJY'><dir id='0nWJY'><q id='0nWJY'></q></dir></style></legend>
                • <tfoot id='0nWJY'></tfoot>
                      <bdo id='0nWJY'></bdo><ul id='0nWJY'></ul>

                      <i id='0nWJY'><tr id='0nWJY'><dt id='0nWJY'><q id='0nWJY'><span id='0nWJY'><b id='0nWJY'><form id='0nWJY'><ins id='0nWJY'></ins><ul id='0nWJY'></ul><sub id='0nWJY'></sub></form><legend id='0nWJY'></legend><bdo id='0nWJY'><pre id='0nWJY'><center id='0nWJY'></center></pre></bdo></b><th id='0nWJY'></th></span></q></dt></tr></i><div id='0nWJY'><tfoot id='0nWJY'></tfoot><dl id='0nWJY'><fieldset id='0nWJY'></fieldset></dl></div>