如何在apache中将任何网页重定向到另一个

时间:2018-09-13 16:48:24

标签: apache .htaccess laravel-5

我有laravel项目,并且具有以下htaccess:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(www.)?thebooks.ca$ 
RewriteCond %{REQUEST_URI} !^/public/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /book_donation/public/$1 
RewriteCond %{HTTP_HOST} ^(www.)?thebooks.ca$ 
RewriteRule ^(/)?$ book_donation/public/ [L] 

但是似乎只有在我请求thebooks.ca而不是thebooks.ca/foo这样的其他网址时才能起作用,因此如何解决此问题?

1 个答案:

答案 0 :(得分:0)

您在index.php中编写此代码

? header(“ location:http://thebooks.ca/foo/”); ?>