Redirecting page links after .htaccess SEO upgrade? -
i didn't want bloat 1 post here ton of .htaccess questions, i'm breaking them individually. 1 has using redirectmatch
create rules existing, indexed pages part of existing website.
specifically, test site has been year , using .htaccess re-write clean urls better seo. when had container page content called based on query string in link, so:
http://www.website.com/departments.php?dep=contact_us
i'm working on making url appear smoother like:
http://www.website.com/contact-us/
the tutorial read suggested changing links new, snazzier seo-friendly style lead lots of 404 errors , broken page links until site has been indexed again , records brought date.
thus, question: legitimate concern or new links picked in 24-48 hours?
i ask because have several websites many layers of file structure , i'm thinking i'd need ton of rules in .htaccess file fix broken links may creating.
if i'm creating confusion here, please let me know , i'll clarify things.
many in advance!
thus, question: legitimate concern or new links picked in 24-48 hours?
you can make happen sooner if externally redirect client using 301 (permanent). lot trickier internally rewriting on server's end because you'll cause conflicting rules. example, if wanted rewrite url-a url-b internally on server, redirect browser url-b url-a (meaning when client requests url-b redirect url-a):
# internally rewrite url-a (fake url) url-b (where actual content is) rewriterule ^url-a$ /url-b [l] # externally redirect url-b (actual content) url-a (fake url) rewriterule ^url-b$ /url-a [l,r=301]
since rewrite engine loops, these 2 rules continue rewrite each other , cause 500 internal server error (the same thing happens if replace second rule redirectmatch
). fix this, need create condition external redirect (second rule) gets applied if actual request "url-b". can matching against %{the_request}
variable, first line of http request.
using example urls, you'd have this:
rewriterule ^contact-us/?$ /departments.php?dep=contact_us [l] rewritecond %{the_request} ^(get|head)\ /departments\.php\?dep=contact_us rewriterule ^ /contact-us/ [l,r=301]
this means when google-bot attempts resolve http://www.website.com/departments.php?dep=contact_us
, 2nd rule's condition match request (which like: get /departments.php?dep=contact_us http/1.1
) , redirected http://www.website.com/contact-us/
. @ point, client (google-bot) request /contact-us/
, first rule applied , internally rewrite uri /departments.php?dep=contact_us
.
Comments
Post a Comment