2012-01-31 41 views
0

我有一个删除index.php(codeigniter)的htaccess文件。我遇到了Paypal问题,导致返回的URL使用查询字符串,这在codeigniter中很麻烦。将... /?token = xx-xxx转换为.../xx-xxx

这是我的htaccess的文件:

RewriteEngine on 
RewriteBase/

# Hide the application and system directories by redirecting the request to index.php 
RewriteRule ^(application|system|\.svn) index.php/$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [QSA,L] 

我要重写以下示例URL-S:

http://.../site/bookingconfirmed/?token=EC-56G61173NH540131H 

http://.../site/bookingconfirmed/EC-56G61173NH540131H 

http://.../site/bookingdeclined/?token=EC-56G61173NH540131H 

http//.../site/bookingdeclined/EC-56G61173NH540131H 

任何好的想法如何做到这一点?

回答

0

添加右下方RewriteBase /

#for booking confirmed and declined 
RewriteCond %{REQUEST_URI} /site/booking(confirmed|declined)/$ [NC] 
RewriteCond %{QUERY_STRING} (^|&)token=([^&]+)(&|$) [NC] 
#rewrite to /site/bookingdeclined/EC-56G61173NH540131H 
RewriteRule^%{REQUEST_URI}%2 [L] 

这些规则,如果你想改变让客户看到他们的地址栏中的网址更改最后一个规则

RewriteRule^%{REQUEST_URI}%2 [L,R=301] 
相关问题