我需要建立应用程序,我使用codeigniter。 公司向我发送格式的链接,不能从他们身边来改变 Link是这样的:Apache重写url codeigniter
someurl.com/sms.php?phone=12345678&msg=msg15&code=777&country=cc&oper=someoper& mssid=1234567892¬charged=0&date=2011-12-26+23%3A31%3A27&keyword=msg&created=2011-12-26+23%3A31%3A26
我怎样才能用的.htaccess重写,因此笨获取分段格式的链接像
someurl.com/sms/myfunction/12345678/msg15/777/cc/someoper/1234567892/0/2011-12-26+23%3A31%3A27/msg/2011-12-26+23%3A31%3A26
谢谢
编辑。 花了几个小时,并试图像这样:
RewriteEngine On
RewriteBase/
RewriteCond %{QUERY_STRING} ^phone\=([^&]+)\&msg\=([^&]+)\&code\=([^&]+)\&country\=([^&]+)\&oper\=([^&]+)\&mssid\=([^&]+)\&date\=([^&]+)\&keyword\=([^&]+)$
RewriteRule ^test\.php$ /sms/doParse/%1/%2/%3/%4/%5/%6/%7/%8 [R,L]
然后输入网址这样的:
http://test.airtel.lv/test.php?phone=12345678&msg=msg15&code=777&country=cc&oper=someoper&mssid=1234567892&date=2011-12-26+23%3A31%3A27&keyword=msg
我得到这个:
http://test.airtel.lv/sms/doParse/12345678/msg15/777/cc/someoper/1234567892/2011-12-26+23%253A31%253A27/msg?phone=12345678&msg=msg15&code=777&country=cc&oper=someoper&mssid=1234567892&date=2011-12-26+23%253A31%253A27&keyword=msg
为什么返回的URL有GET在PARAMS结尾 ? 还有一个问题,如果该公司将改变并添加额外的参数链接,重写将被打破?那么它如何更普遍?
试图访问 返回所请求的网址/短信/ myfunction的/ 12345678/msg15/777/CC/someoper /11111分之1234567892/msg未找到。 CI使用链接像http://sms.airtel.lv/index.php/sms/doParse,我不能访问它没有的index.php CI已经“启用查询字符串” 也许会更好重写URL对于查询字符串如 sms.php?phone .... to sms.php?c = sms&m = doParse&phone = 12345678&msg = msg15&code = 777&country = cc&oper = someoper&mssid = 1234567892&date = 11111&keyword = msg 我只是想在链接是新的param它不会制止我的逻辑,导致段没有GET名称,只有值 – rtt 2012-01-08 06:46:11