donglun1918 2019-01-01 14:31
浏览 17

htaccess中主页索引文件的RewriteRule异常

Trying to apply rewriterule on pages.php via htaccess but not able to exclude index.php. How can I do this?

RewriteRule ^index.php$ - [L]

RewriteRule ^([-a-zA-Z]*)$ pages.php?state=$1 [L]

Through the RewriteRule applied on pages.php via htaccess, the pages are opening fine that are stored in database in the following manner:-

domain.com/delhi

domain.com/gujarat

domain.com/jammu-and-kashmir

and so on. The problem I'm facing here is that when I'm trying to access my root site, i.e. index.php as domain.com, it is returning 404. When I try to access the index.php as domain.com/index.php, it works fine. I tried couple of ways to exclude my index file from the applied rule on pages.php but no gain. Could someone help me how to actually exclude index.php from the rule applied on pages.php to make it open on the root of the domain please?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

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