创建漂亮的网址,但不是用斜杠 [英] creating nice url but not with slashes

查看:70
本文介绍了创建漂亮的网址,但不是用斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几乎所有事情我都使用我的index.php作为标准''page''的值。但是,当我查看我的产品时,这是一个类似的东西

www.mysite.com/index.php?page=2&kwd=1.0096&description=Love to give& type = album

待观看

www.mysite.com +专辑+ 1.0096 +爱给予


请注意我没有问题作为分隔符的斜线然后我必须更改图像的所有src的属性,并且我已经阅读了其他任何类似''+''或''的内容:''作为分隔符将起作用,是真的吗(在一个带有斜杠的工作示例中尝试使用+替换它们在.htaccess文件中,并且当我评论+时没有找到对象,当时没有找到它);

这也是我的描述空间,在两个多工作的示例中工作正常,但读到某处我必须通过urlencode()或类似的东西传递它们,是否需要在.htaccess文件中更改此内容?

解决方案

加号htaccess语句中的符号表示前面一个或多个字符/范围。所以你需要逃避符号。我没有尝试在我的网址中加上+,所以试一试,但我怀疑这就是为什么它不起作用。我希望简单的\字符就足够了,但你可能不得不玩{QUERY_STRING}条件??


试过但不行,有人可以给出一个例子吗?


@ mikek12004


这看起来不是一个好选择,因为所有似乎都是域名的一部分,我不确定,这是否有查询字符串?

展开 | 选择 | Wrap | N行umbers

Almost for all thing I use my index.php with the value of ''page'' as a criterion. However when I view my products which is something like this
www.mysite.com/index.php?page=2&kwd=1.0096&description=Love to give&type=album
to be viewed
www.mysite.com+album+1.0096+Love to give

note that I do not have a problem with the slashes as seperators but then I have to change all the src''s attributes of the images and I have read somewhere that woth anything else like ''+'' or '':'' as a separator will work, is it true (in a working example with slashes tried to replace them in the .htaccess file with + and got object not found both when I commented the + and when not);
the is also the point of having in my description spaces, in an example of two with multiwork get worked ok, but read somewhere I have to pass them through urlencode() or something like that, is it necessery and changes this anything in the .htaccess file?

解决方案

The plus symbol in a htaccess statement means one or more of the preceding character/range. So you need to escape the symbol. I haven''t ever tried to have + in my urls, so give it a go, but I suspect that''s why it''s not working. I hope that a simple "\" character will be enough, but you might have to play around with a {QUERY_STRING} condition??


tried but not working, anyone could give an example?


@mikek12004
this doesn?t look like a good choice, since all seems to be part of the domain and I?m not sure, whether this has a query string at all?

Expand|Select|Wrap|Line Numbers


这篇关于创建漂亮的网址,但不是用斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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