url rewriting - Cleaning up URL's for an existing Website -
quick question, there way clean url's existing website? mean lets have existing link http://www.webawwards.com/website?id=320 want make http://www.webawwards.com/terna
is there way clean url if there existing links current url link still go through?
could please direct me right way? thank you
if want hard-code urls .htaccess
file can set static redirects:
<ifmodule mod_rewrite.c> rewriteengine on rewritecond %{query_string} ^id=320(.*)$ rewriterule /website$ /terna [l,nc] rewritecond %{query_string} ^id=321(.*)$ rewriterule /website$ /somewhere-else [l,nc] </ifmodule>
however if want make more flexible (maybe let people change own redirects, or similar) you'd need store in database (redirects
table, columns of website_id, redirect_url
) when queries, (pseudo-code):
if (isset( querystring['id'] )) query( select redirect_url redirects website_id = querystring['id'] ) redirectto( redirect_url ); exit
in php, actual redirect done header('location: ' . $redirect);
, , query part should easy enough.
Comments
Post a Comment