duanchongchu5177 2017-03-24 05:00 采纳率: 0%
浏览 71

Mod Rewrite for Friendly URL 500错误

I need to convert these 3 URLs:

1 - Mydomain/view/index.php?make=toyota&model=runner&color=white

2 - Mydomain/view/index.php?make=toyota&model=runner

3 - Mydomain/view/index.php?make=toyota

Into these:

1 - Mydomain/toyota/runner/white

2 - Mydomain/toyota/runner

3 - Mydomain/toyota


So I used an online Mod Rewrite tool generator and got this for the FIRST url:

RewriteEngine On RewriteRule ^([^/])/([^/])/([^/]*)$ /view/index.php?make=$1&model=$2&color=$3 [L]

It worked perfect when I used the FIRST friently URL. Then I just copied and modified that RewriteRule twice and used them for the other two URLs, resulting into this:

RewriteEngine On

RewriteRule ^([^/])/([^/])/([^/]*)$ /view/index.php?make=$1&model=$2&color=$3 [L]

RewriteRule ^([^/])/([^/])$ /view/index.php?make=$1&model=$2 [L]

RewriteRule ^([^/]*)$ /view/index.php?make=$1 [L]


First friendly URL still works fine. Second and third URLs stops on 500 Internal Server Error.

Would somebody help? Thanks!

  • 写回答

1条回答 默认 最新

  • dongtan6543 2017-03-24 05:19
    关注

    You need to exclude the destination uri you are rewriting to. To fix the loop error ,add the following at top of your htaccess right after RewriteEngine on line

    RewriteRule index\.php$ - [L]
    
    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数