【问题标题】:I want to redirect all requests to main domain我想将所有请求重定向到主域
【发布时间】:2020-05-23 03:57:48
【问题描述】:

当写https://new.example.com/course/comptia 并转到源代码,将所有发送到 index.php 的请求写入 htaccess 然后当在我的源代码中查看带有插件的 url 时全部发送到 index.php 像 App/Assets/... 当点击它时发送给我 https://new.example.com/course/App/Assets/...

course-> 当点击 App/Assets/... 时,不是目录如何发送给我 致https://new.example.com/App/Assets/... 到没有查询请求 uri 的主域?

【问题讨论】:

    标签: javascript php .htaccess


    【解决方案1】:

    尝试将此添加到您的 .htaccess 文件中:

    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php
    
    </IfModule>
    

    【讨论】:

    • &lt;IfModule mod_rewrite.c&gt; &lt;IfModule mod_negotiation.c&gt; Options -MultiViews &lt;/IfModule&gt; RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !.(js|gif|jpg|png|css|eot|svg|ttf|woff|woff2|map)$ index.php &lt;/IfModule&gt;
    • 这是我的 htaccess 但不工作你可以检查这个https://new.arabcbt.com/course/CompTIA_Security+501
    【解决方案2】:

    在你的 .htaccess 中尝试这样做:

    RewriteEngine On
                RewriteCond %{HTTP_HOST} !oldexample.com$ [NC]
                RewriteRule ^(.*)$ http://www.newexample.com/$1 [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-21
      • 2013-06-24
      • 2020-04-24
      • 2017-06-29
      • 1970-01-01
      • 2015-12-29
      • 2015-03-21
      相关资源
      最近更新 更多