URL Rewrite from base (without prefix) .htaccess -
i developing short link website brand, , need have links this:
http://demo-name.com/[shortvalue]
i understand how following:
http://demo-name.com/l/[shortvalue]
using basic rewrite rule, however, unsure of how without prefix of l
.
i need able go to
http://demo-name.com/file.php
to run files, needs possible.
if possible, able have
http://demo-name.com/[shortvalue]?key=val&key2=val2 ^^^^^^^^^^^^^^^^^^
query string @ end of url's, if [qsa]
possible well, great!
you can test if file directory (-d
) or file (-f
) in rewritecond
.
rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/\.]+)$ index.php?shorturl=$1 [l,qsa]
this rule rewrite "shortvalue" without slashes or dots index.php?shorturl=shortvalue
.