duanpo7282 2014-04-30 02:18
浏览 77

Zend,将index.php重定向到index.html

My SEO wants me to rewrite index.php to index.html.

The probnlem is that I am using ZEND. When I go to index.php, I lands on my custom exception page, because Zend maybe don't want to understand that some SEO people that are external to PHP don't want to get index.php redirects to an exception page.

I understand Zend wants it all for PHP (And I am waiting them to rewrite an AngularJS version into PHP for Zend3) but.... meanwhile, I am stuck with Zend at the moment, and I can't figure out how I can modify my .htaccess.

At the moment, it looks like this :

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

If I add :

RewriteRule ^index.php$ index.html [NC,L]

This breaks Zend.

Do I have to rename my index.php file to zend.php, and then, modify the last line to :

RewriteRule ^.*$ zend.php [NC,L]

Or do I have to write a 1500 line long action helper code to make it the Zend way?

  • 写回答

4条回答 默认 最新

  • dougu8742 2014-04-30 02:37
    关注

    Don't you just want something like this? (Before the rules you have, just below the RewriteEngine On):

    RewriteCond %{THE_REQUEST} \ /+index\.php
    RewriteRule ^ /index.html [L,R=301]
    
    RewriteRule ^index.html$ /index.php [L]
    
    评论

报告相同问题?

悬赏问题

  • ¥15 r包runway详细安装教程
  • ¥15 Html中读取Json文件中数据并制作表格
  • ¥15 谁有RH342练习环境
  • ¥15 STM32F407 DMA中断问题
  • ¥15 uniapp连接阿里云无法发布消息和订阅
  • ¥25 麦当劳点餐系统代码纠错
  • ¥15 轮班监督委员会问题。
  • ¥20 关于变压器的具体案例分析
  • ¥15 生成的QRCode圖片加上下載按鈕
  • ¥15 板材切割优化算法,数学建模,python,lingo