douzha8489 2013-10-23 19:04
浏览 28
已采纳

将所有页面重定向到SAME域上的单个页面

There are versions of this question already posted but i cannot get their suggestions to work.

Here is what i have already in my htaccess

Options +FollowSymLinks 
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ $1.php
RewriteRule ^home\.php$ index.php 
RewriteRule ^home$ index.php

and here is what i tried:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ $1.php
RewriteRule ^home\.php$ index.php 
RewriteRule ^home$ index.php
RewriteRule ^(.*)$ http://www.trainingthemlive.co.uk/maintenance.php [R=302,L]

No luck, just completely fails. I'd like www.trainingthemlive.co.uk to go to www.trainingthemlive.co.uk/maintenance

It's also worth noting that the maintenance.php page is in the root folder and def exists

  • 写回答

2条回答 默认 最新

  • douzi9211 2013-10-23 19:14
    关注

    You need to make sure not to redirect the maintenance page, and you probably want it before your other rules:

    Options +FollowSymLinks
    RewriteEngine on
    
    RewriteRule !^/?(maintenance\.php|.*\.css|.*\.js)$ http://www.trainingthemlive.co.uk/maintenance.php [R=302,L]
    
    RewriteRule ^([A-Za-z0-9]+)$ $1.php
    RewriteRule ^home\.php$ index.php 
    RewriteRule ^home$ index.php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?