URL重写休息时的index.php URL =指数?(参数"指数")。为什么? [英] URL rewriting breaks when index.php?url=index (parameter is "index"). Why?

查看:204
本文介绍了URL重写休息时的index.php URL =指数?(参数"指数")。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的问题:我用这个的.htaccess:

Weird issue: I'm using this .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

要获得这些URL。完美。

to get these URLs. Works perfectly.

http://www.example.com/cool/url

问题

但是,当?网址的-parameter有单词索引在里面,就像

Problem

But when the ?url-parameter has the word index in it, like in

http://www.example.com/index/page

然后$ _GET [网址]是空的。我想我的重写规则被打破(尽管我已经看到的正是这种重写规则在很多的教程)和index.php文件的URL中移除还会删除索引参数。

then $_GET["url"] is empty. I think my RewriteRule is broken (despite i've seen exactly this RewriteRule in lots of tutorials) and the removing of index.php from the URL also removes the index-parameter.

如何解决,如何使类似的索引/页的URL可能吗?

How to fix, how to make URLs like index/page possible ?

推荐答案

这是由于的 MultiViews选项

This is due to MultiViews option.

添加此行对你的的.htaccess 文件顶部禁用多视​​图

Add this line on top of your .htaccess file to disable MultiViews:

Options -MultiViews

这篇关于URL重写休息时的index.php URL =指数?(参数"指数")。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆