【问题标题】:htaccess FallbackResource redirecting root domainhtaccess FallbackResource 重定向根域
【发布时间】:2018-01-01 06:38:18
【问题描述】:

我正在使用 FallbackResource 将任何丢失的链接重定向到 /user.php,但它也会重定向根域(“incupe.com”)。它不应该重定向那个!如果明确输入“incupe.com/index.php”,它只会停止重定向。请帮忙!这是我的 .htaccess 文件:

# Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
RewriteBase /

# Always use https for secure connections
# Replace 'www.example.com' with your domain name
# (as it appears on your SSL certificate)
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.incupe.com/$1 [R=301,L]

Options All -Indexes
FallbackResource /user.php

提前致谢!

【问题讨论】:

    标签: php apache .htaccess redirect


    【解决方案1】:

    如果您只想将丢失的链接重定向到 user.php,请将以下内容放入 .htaccess 而不是您的代码。

    RewriteEngine on
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ user.php [L]
    
    Options All -Indexes
    

    如果您有任何虚拟 URL,这将不起作用。

    【讨论】:

      猜你喜欢
      • 2014-06-24
      • 2012-11-18
      • 2013-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-23
      • 2017-06-26
      相关资源
      最近更新 更多