htaccess FallbackResource重定向根域

时间:2018-01-01 06:38:19

标签: php apache .htaccess redirect

我使用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

提前致谢!

1 个答案:

答案 0 :(得分:0)

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

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ user.php [L]

Options All -Indexes

如果您有任何虚拟网址,则无法使用。

相关问题