php - REWRITE URL and keep QUERY STRING in .htaccess -
here .htaccess code...
errordocument 404 /404.html options -multiviews rewriteengine on rewritecond %{request_uri} !-d rewritecond %{request_uri} !-f rewritecond %{request_uri} !\.php$ rewritecond %{request_uri} !\.css$ rewritecond %{request_uri} !\.js$ rewritecond %{request_uri} !\.png$ rewritecond %{request_uri} !\.mp3$ rewritecond %{request_uri} !\.jpg$ rewritecond %{request_uri} !\.html$ rewritecond %{request_uri} !\.xml$ rewritecond %{request_uri} !\.txt$ rewritecond %{request_uri} !\.gif$ rewriterule ^(.*)$ /$1.php [l] rewritecond %{http_host} ^www\.example\.com$ rewriterule ^/?$ "https\:\/\/example\.com" [r=301,l]
i want have: example.com/buy?r=abc123 appear like: example.com/release/abc123 or like: example.com/abc123
i cannot $_get contents of r in buy.php once url has been redirected.
i hope can :)
if want clean urls can use:
rewriterule ^([^/]*)$ /buy?r=$1 [l]
to example.com/abc123
or can use:
rewriterule ^release/([^/]*)$ /buy?r=$1 [l]
to example.com/release/abc123
.
just make sure clear cache before testing this.
Comments
Post a Comment