2012-01-31 39 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] 
相關問題