阿帕奇/ mod_rewrite的/周期与格局搞乱 [英] Apache / mod_rewrite / Periods messing with pattern

查看:104
本文介绍了阿帕奇/ mod_rewrite的/周期与格局搞乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一个问题,在这里不用什么...

First question, here goes nothing...

我想要一个新的条目翻译这个网址的希望添加到我的.htaccess文件(Apache服务器):

I'm trying to add a new entry to my .htaccess file (Apache server) with the hopes of translating this URL:

http://platform.localhost/category.all

到这个网址:

into this URL:

http://platform.localhost/index.php?page=category.all

这是我目前使用的重写规则是这样的:

The RewriteRule that I'm currently using is this:

RewriteRule ^([^/\.]+)\/?$ index.php?page=$1

此规则已高达正常工作,对所有URL到现在为止,我只能认为它是打破它的期限。

This rule has worked fine for all URLs up until now, I can only assume that it is the period that is breaking it.

我试图做到的,是有什么在URL后。HTTP://platform.localhost/传递到index.php的页面变量

What I'm trying to achieve is having anything in the URL after the "http://platform.localhost/" passed into the "page" variable of index.php.

我知道,我已经错过了一些愚蠢的事,可有人请仁慈地指出来?

I know I've missed something stupid, can someone please be kind enough to point it out?

干杯

推荐答案

模式表示拒绝点,但你可以做TIS:

the pattern says to reject dots, but you could do tis:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [QSA,L]

这篇关于阿帕奇/ mod_rewrite的/周期与格局搞乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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