php - Change URLs with .htaccess -
i have website i'm trying change urls on. of urls start http://domain.com/?
for example, http://domain.com/?index
i want remove question mark. don't care if appears in address bar, want users able access pages on site without having type question marks.
so, if user wants access http://domain.com/?index, want them able access typing http://domain.com/index.
is possible using .htaccess?
i've searched around , tried few different things few days , still can't figure out way accomplish i'm trying do.
any appreciated.
thanks.
try:
rewriteengine on # match against request instead of uri rewritecond %{the_request} ^[a-z]{3,9}\ /\?([^&\ ]+)&?([^\ ]*) rewriterule ^$ /%1?%2 [l,r=301]
this takes uri's http://example.com/?path/to/file.txt
, redirects browser http://example.com/path/to/file.txt
. browser display url in location bar instead. is, of course, assuming if actually goes url, there there served other 404.
edit
to internally map none-query string urls 1 query string:
rewriteengine on rewritecond %{request_uri} !^/$ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /?$1 [l]
Comments
Post a Comment