重写规则将不会在.htaccess文件工作 [英] RewriteRule will not work in .htaccess file

查看:110
本文介绍了重写规则将不会在.htaccess文件工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现对堆栈的几个问题有很多节目和大量的实例,但我已经试过大家在这本书和这个拒绝工作。

I have found several questions on Stack that have show lots and lot of examples, but I have tried everyone in the book and this refuses to work.

我尝试转换。

www.domain.com/title/index.php?id=70048305

www.domain.com/title/70048305

我希望它被转换两种方式。当他们输入的查询字符串,并用干净的URL。

I want it to be converted both ways. When they type in with the query string and with the clean url.

什么是错的我重写?

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^title/(.+)$ index.php?id=$1 [L,QSA]

我要指出,我无论在根和/标题/文件夹放在这个.htaccess文件。

I should note that I've placed this .htaccess file both on the root and in the /title/ folder.

推荐答案

试试这个

RewriteEngine On

RewriteRule ^([a-zA-Z0-9-+/]+)$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9-+/]+)/$ index.php?id=$1

这篇关于重写规则将不会在.htaccess文件工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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