I have made a website with this line in the .htaccess
file:
RewriteRule ^(.\*)/(.\*)/(.\*)$ index.php?module=$1&action=$2&value=$3 [QSA,L]
The problem is, when the last parameter starts with a hashtag, it doesn't get assigned to 'value', even if i encode it with php function urlencode()
, the link looks like this (beginning omitted):
.../search/searchTweets/%23tweet
and when printing the $_REQUEST
variable this is the result:
array(3) { ["module"]=> string(6) "search" ["action"]=> string(12) "searchTweets" ["value"]=> string(0) "" }
The string following the hashtag is called fragment identifier and it's a client-side only part of the URL. It's never sent to the server.
If your URL has always the same structure, you can rewrite the rule without the last group (i.e. ^(.*)/(.*)
) and use JavaScript to pull it.
If you need any help, let me know and I'll write you an example.