从pretty重写URL以丑吗? /东西 - > ?A =财产以后 [英] Rewrite URL from pretty to ugly? /something -> ?a=somthing

查看:89
本文介绍了从pretty重写URL以丑吗? /东西 - > ?A =财产以后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用URL重写访问此...

I'm looking to use url rewrite to access this...

http://url.com/?a=value

通过...

http://url.com/value

因此​​,通过使用url.com/value我实际加载url.com/?a=value。

So that by using url.com/value I'm actually loading url.com/?a=value.

我假设我需要把一个重写的一个htaccess文件,然后莫名其妙地发现这index.php文件,并拉出字段值?这是一个有点超出了我很遗憾这样真的很AP preciate你的帮助。

I'm assuming I need to put a rewrite in an htaccess file and then somehow detect this in index.php and pull out the field value? It's a bit beyond me unfortunately so would really appreciate your help.

谢谢!

推荐答案

这的.htaccess code考虑了类似的 http://url.com/value?parameter=something

This .htaccess code takes into consideration something like http://url.com/value?parameter=something

RewriteEngine On

RewriteRule ^([A-Za-z0-9-/]+)\&(.*)$ /$1?$2 [R]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-/_]+)$ /index.php?a=$1&${QUERY_STRING} [L,QSA]

这篇关于从pretty重写URL以丑吗? /东西 - > ?A =财产以后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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