3

On my website I have URLs like this:

http:// www.domain.com/something-like-page-title-4en

With ISAPI Rewriter (Ionics Isapi Rewrite Filter) I have following rule:

RewriteRule ^/([^.?]+[^.?/])$  /index.php?URL_string=$1 [L,U]

That means, above rule is transforming above URL to:

http://www.domain.com/index.php?URL_string=something-like-page-title-4en

If someone likes above URL on Facebook, Facebook adds additional tracking parameters into my URL and it looks like:

http://www.domain.com/something-like-page-title-4en?fb_action_ids=2159471566173547&fb_action_types=og.likes&fb_source=712&action_object_map=%7B%2780201701278628651%22%3A10110880521592526%7D&action_type_map=%7B%2210201714908651773%22%3A%22og.likes%22%7D&action_ref_map=%5B%5D

My above rule is not able to process such URL (with a query string). What I need is rule which will be able to catch both URLs, with query strings and without them, and to process URLs as follows:

Example 1 (URL with Query String):

Original URL:

http://www.domain.com/something-like-page-title-4en?param1=value1&param2=value2

Rewritten URL:

http://www.domain.com/index.php?URL_string=something-like-page-title-4en&param1=value1&param2=value2

Example 2 (URL without Query String):

Original URL:

http://www.domain.com/something-like-page-title-4en

Rewritten URL:

http://www.domain.com/index.php?URL_string=something-like-page-title-4en

Thanks a lot.

4

1 回答 1

2

使用 QSA(查询字符串附加)标志:

RewriteRule ^/?([^/]+)/?$ /index.php?URL_string=$1 [L,U,QSA]
于 2013-08-26T20:26:04.477 回答