法国字符重写规则 [英] French characters with rewrite rule

查看:131
本文介绍了法国字符重写规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的数据库类的名字,以及一些主题有法国的人物,如E E E。 它可以根据需要,直到今天,当我试图添加其他字符到它,然后我开始SERVER ERROR

I have categories name in my database, and some of theme have french characters like é è ê. It works as desired until today when I tried to add another character à to it then I started getting SERVER ERROR

下面是我的.htaccess:

Here is my .htaccess:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9éèêà_-\s]+)-(\d+)\.htm$   classified.php?id=$2 [L]

正如你所看到的,它工作正常,而不单。

As you can see, it works fine without the à.

我如何添加东西进入正则表达式?

How do I add that thing into the regex ?

推荐答案

如果您正在使用的所有排序的字符和重音字母的,那么为什么不只是让什么去了?

If you are using all sort of characters and accented letters, then why don't just allow anything to go by?

注:使用本规则也将使空间;

NOTE: Using this Rule will also allow spaces;

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)-(\d+)\.htm$   classified.php?id=$2 [L]

和以后,如果你决定限制正则表达式,可以说你不想要这些字符#$%,那么你必须做出例外:

And later if you decide to limit the regex, lets say you don't want any of these characters # $ % then you have to make exceptions:

   Options +FollowSymlinks
  RewriteEngine on
  RewriteRule ^([^#$%]+)-(\d+)\.htm$   classified.php?id=$2 [L]

这篇关于法国字符重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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