Reputation: 14791
I am working on a SilverStripe 4 project. I am trying to show a different page when the user visits the home page without changing the URL. I am configuring it in the .htaccess. But it is not working.
Following is my .htaccess file under the root folder of the project
RewriteEngine On
RewriteRule ^(.*)$ public/$1
RewriteRule ^/ /welcome [P]
When I visit the home page, it is still showing the home page. What is missing in my code and how can I fix it?
Upvotes: 0
Views: 126
Reputation: 784998
L
(last) flag instead of P
(proxy) flag.public
rule to avoid looping.You may use these rules in site root .htaccess:
RewriteEngine On
RewriteRule ^/?$ welcome [L]
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule ^(?!public/)(.+)$ public/$1 [L,NC]
Upvotes: 1