RewriteEngine叙述上的.htaccess不工作 [英] RewriteEngine On .htaccess not working

查看:154
本文介绍了RewriteEngine叙述上的.htaccess不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的请求,我该怎么处理这样的文件

I am trying to make my requests how I handle files like this

/ R /登录

但认为转至服务器类似的index.php?R =登录

but have that go to the server like index.php?r=login

这是我使用似乎并不奏效这htaccess的code

This htaccess code that I am using does not seem to be working

Options +FollowSymLinks

RewriteEngine On
RewriteRule ^/r/([0-9]+)/$ index.php?r=$1

如果有人可以帮助我,这将是伟大的!

If anyone could help me out, that would be great!

推荐答案

您code的问题是,你正在使用的重写规则斜线。如果在.htaccess斜线使用由Apache的去除。改变你的规则是:

Your code's problem is that you're using leading slash in RewriteRule. If used in .htaccess leading slash is removed by Apache. Change your rule to this:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^r/([0-9]+)/?$ /index.php?r=$1 [L,QSA,NC]

这篇关于RewriteEngine叙述上的.htaccess不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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