[英].htaccess rule for landing page only
I am building a php framework and at the moment i have these .htaccess rules for directing to my index and getting the controllers and arguments from the URL 我正在构建一个php框架,目前我有这些.htaccess规则可用于定向到我的索引并从URL获取控制器和参数。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php/$1
But since the site is not ready yet I need to add a rule for when accessing root directly to forward to comingsoon.php any idea how? 但是,由于该站点尚未准备就绪,因此我需要在直接访问root以转发到comeningsoon.php时添加一条规则,这是怎么回事?
Add this rule before the other one. 在另一条规则之前添加此规则。 This matches www.site.com or www.site.com/ 这与www.site.com或www.site.com/匹配
RewriteRule ^/?$ /commingsoon.php
Pasted from Symfony2 Framework .htaccess
file (replaced app.php
with index.php
) but it should works. 从Symfony2 Framework .htaccess
文件粘贴(将app.php
替换为index.php
),但它应该可以工作。 Try it: 试试吧:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
</IfModule>
</IfModule>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.