douji8033 2015-07-24 18:18
浏览 199

只有一个文件排除ReWriteRule,其余文件重定向到php

Here is my .htaccess file and At the end you can see it redicts all html to php. But I want to exclude one file. And what If I want more than 1 file to be not redirected?

I've tried to add

    RewriteCond %{REQUEST_URI} !^/googlede35cf4037671fba\.html$ [NC] 

but it did not work.

    RewriteEngine On
    RewriteRule all-([0-9]+)\.html$ all.php?page=$1 [L]
    RewriteRule profile-([0-9]+)-(.*)\.html$ profile.php?id=$1&user=$2 [L]
    RewriteRule upvote-([0-9]+)-(.*)\.html$ upvote.php?id=$1&user=$2 [L]
    RewriteRule comments-([0-9]+)-(.*)\.html$ comments.php?id=$1&user=$2 [L]
    RewriteRule post-([0-9]+)-(.*)\.html$ post.php?id=$1&title=$2 [L]
    RewriteRule category-([0-9]+)-(.*)-([0-9]+)\.html$ category.php?cid=$1&name=$2&page=$3 [L]
    RewriteRule userq-([0-9]+)-([0-9]+)\.html$ userq.php?id=$1&page=$2 [L]
    RewriteRule usera-([0-9]+)-([0-9]+)\.html$ usera.php?id=$1&page=$2 [L]
    RewriteRule ^(.*)\.html$ $1.php [L]
  • 写回答

1条回答 默认 最新

  • dtzd65908 2015-07-24 18:22
    关注

    Oops. Just refreshed again and it looks like it worked. It is the correct way to exclude right? So I have more than 1 file, I can just write another ReWriteCond rule i guess?

    RewriteCond %{REQUEST_URI} !^/googlede35cf4037671fba\.html$ [NC] 
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度