.htaccess - htaccess: Mediafire.com like urls -


I translate http://example.com/?7gudznrxdnu to try to come up with some mod_rewrite I am http://example.com/view.php?id=7gudznrxdnu

but any other page will work properly such as http : // example .com / contact and so on.

I think this will work:

  Rewrite on Rewight Engines % {QUERY_STRING} ^ [a-z0- 9] + $ rewrite rule ^ $ view.php? Id =% {QUERY_STRING} [L]   

If you want to re-type in the address field of the browser, you will see [L] with [L, R = 301] must be changed.

Explanation: The query-string (which is following the question marks) is not a part of the URL that the reversal sees in its matching pattern, Can not check. In my solution, I run the rule and if only use az and / or 0-9 in the query string ( RewriteCond ) Is done, and my rule only rewrites the ending URL with a slash (except for the query string) I call it view.php? Id = , and then add the query string to it.

Edit: Tested on my Apache-server, and I did not find any bugs (yet).

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

memcached - Django cache performance -