I simply want to rewrite a hash # or other symbol to a question mark via htaccess. So any hash in the URL anywhere should internally rewrite to a ?. All I want is to remove ? from the URL really. Thanks in advance.
If you're talking about the hash like http://forums.digitalpoint.com/showthread.php?t=1551340#post12786954 it can't be done. Those are set by the browser and are not be read by Apache. Your best bet would be to catch it using JavaScript and redirect that way.
I'm referring to the question mark in the URL: http://forums.digitalpoint.com/showthread.php?t=1551340#post12786954 Can that be re-written from something else to the question mark or can the query string somehow be removed while still retaining its effect. ie it works exactly the same but no one can see the query string in the URL.
Ah gotcha. Short answer is yes, as long as you're not using the hashmark. I do a similar thing on detectmobilebrowser.com for the redirection service: http://detectmobilebrowser.com/cnn.com|m.cnn.com Here's an example of what your rewrite rule might be: RewriteRule ^([^\|]+)\|(.+)$ /$1?$2 [L] Code (markup): That will take anything like yoursite.com/index.php|foo=bar and redirect it to yoursite.com/index.php?foo=bar Change \| to another character if you want to use a comma or something else.
Hmm it still doesn't seem to work. The URL is of the format: [url]http://www.domain.com/subpage/page?query1=0&query2=0[/url] Code (markup): If I insert the URL as: [url]http://www.domain.com/subpage/page\query1=0&query2=0[/url] Code (markup): using your htaccess code it doesn't work. The URL returns 0 results so the query is not being read.
If you're using the htaccess above you'll want the URL to be http://www.domain.com/subpage/page|query1=0&query2=0
it's something about this var {QUERY_STRING} note that the #ABC it's a book mark and is threated the same way as the GET vars so i think it belongs to the query string and it's not even parsed by mod rewrite in this case... check this list Mod_Rewrite Variables, from Source * TIME – %04d%02d%02d%02d%02d%02d * HTTPS – flag ? "on" : "off" * TIME_DAY * TIME_SEC * TIME_MIN * TIME_HOUR * TIME_MON * TIME_WDAY * TIME_YEAR * IS_SUBREQ – (main ? "true" : "false"); * PATH_INFO – path_info; * AUTH_TYPE – ap_auth_type; * HTTP_HOST – lookup_header("Host", ctx); * SERVER_NAME – ap_get_server_name(r); * REMOTE_ADDR – connection->remote_ip; * SERVER_ADDR – connection->local_ip; * HTTP_ACCEPT – lookup_header("Accept", ctx); * THE_REQUEST – the_request; * API_VERSION – "%d:%d",MODULE_MAGIC_NUMBER_MAJOR,MODULE_MAGIC_NUMBER_MINOR); * HTTP_COOKIE – lookup_header("Cookie", ctx); * SERVER_PORT – ap_get_server_port(r); * REMOTE_HOST * REMOTE_NAME, NULL); * REMOTE_PORT - r->connection->remote_addr->port * REMOTE_USER - user; * SCRIPT_USER - "<unknown>"; * APR_FINFO_USER * REQUEST_URI - uri; * SCRIPT_GROUP - "<unknown>"; * REMOTE_IDENT - ap_get_remote_logname(r); * HTTP_REFERER - lookup_header("Referer", ctx); * QUERY_STRING - args; * SERVER_ADMIN - server->server_admin; * DOCUMENT_ROOT - ap_document_root(r); * HTTP_FORWARDED - lookup_header("Forwarded", ctx); * REQUEST_METHOD - method; * HTTP_USER_AGENT - lookup_header("User-Agent", ctx); * SCRIPT_FILENAME - same as request_filename * REQUEST_FILENAME - same as script_filename * SERVER_PROTOCOL - protocol * SERVER_SOFTWARE - ap_get_server_banner(); * HTTP_PROXY_CONNECTION - lookup_header("Proxy-Connection", ctx);