【发布时间】:2015-08-27 09:02:18
【问题描述】:
我正在尝试配置 Drupal 7 主 .htaccess 文件,在检查 .htaccess 中的某些条件(RewriteCond)后,我需要再检查一个条件(RewriteCond);如果请求是针对 Drupal Front Page。
如果请求是针对首页的,则将其重定向到某个地方,例如“newfrontpage”一个现有页面。
我尝试了什么:
RewriteCond %{REQUEST_URI} ^/index\.php$ #line1
RewriteRule ^(.*)$ http://example.com/newfrontpage [L,NC] #line2
我尝试使用#line1 的其他选项是:
RewriteCond %{REQUEST_URI} ^$
RewriteCond %{REQUEST_URI} ^/node$
没有任何效果。
其他方法可能是 hook_process_page(&$variables) 并检查 if($variables['is_front']).. 但我认为 .htaccess 会更优化!
【问题讨论】:
标签: php apache .htaccess drupal drupal-7