duanhan5230 2015-10-26 17:05
浏览 86

.htaccess重定向L,NC,QSA不按计划工作

so i got these lines in my htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^de/exposes/(.*)$ /exposes/?l=de_DE&m=$1 [L,NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>

and following url:

dev.example.com/de/exposes/whatever

the htaccess checker says, it works as planned and redirects blind to dev.example.com/de/exposes?l=de_DE&m=whatever. but it doesnt. there is always a 404 error.

if i change [L,NC,QSA] to [L,P] it says: object not found.

if i change [L,NC,QSA] to [L,R] it goes to the right URL, but changes the URL and that is what i want to avoid.

Any ideas?

Greetz and thanks

  • 写回答

1条回答 默认 最新

  • dousou2911 2015-10-26 17:10
    关注

    Have it this way:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    
    RewriteRule ^(de/exposes)/(.+)$ $1/?l=de_DE&m=$2 [L,NC,QSA]
    
    RewriteCond %{REQUEST_FILENAME}/index.html !-f
    RewriteCond %{REQUEST_FILENAME}/index.php !-f
    RewriteRule . index.php [L]
    </IfModule>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么