This entry was published at least two years ago (originally posted on January 11, 2006). Since that time the information may have become outdated or my beliefs may have changed (in general, assume a more open and liberal current viewpoint). A fuller disclaimer is available.
Never having quite gotten the hang of .htaccess redirect requests, I’m hoping someone out there might be able to give me a hand with this.
I would like this…
https://michaelhans.com/eclecticism/tags/pickatag
…to map to this (though not wrapped onto multiple lines, obviously)…
http://www.michaelhanscom.com/cgi-bin/mt/mt-tags.cgi?
blog_id=1&tags=pickatag
Similarly, for multiple tags, this…
https://michaelhans.com/eclecticism/tags/pickatag+anytag
…should map to this (and so on, as more tags are added)…
http://www.michaelhanscom.com/cgi-bin/mt/mt-tags.cgi?
blog_id=1&tags=pickatag+anytag
Any ideas? Thanks much in advance!
“Mexican Women” by Throwing Muses from the album Just Say Yo (1988, 2:49).
Ugh… I hate redirect rules… such a pain! I think this should do it:
Note, that should be 2 separate lines with a split after the first /
Soo, any luck with those rules by Ryan?
Not yet, nope. I’ve tried putting those lines in the existing .htaccess at the root of my webspace, and in a new .htaccess under
/eclecticism/
, but still just get 404s when I try to go to/eclecticism/tags/anything
. I’ll keep poking at it…I would try doing a redirect rather than a rewrite to see exactly what it’s trying to rewrite to. ie:
RewriteRule ^eclecticism/tags/(.*)$ /cgi-bin/mt/mt-tags.cig?blog_id=1&tags=$1 [R,L]
Good luck. I’ll break out the ‘mad rewrite-fu’ (as the kids call it these days) if you need—I’ve just eyeballed the rule and it looks ok but haven’t tested it.
you should do it like this
Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html
in your htaccess file
you should do it like this
Redirect /olddirectory/oldfile.html http://yoursite.com/newdirectory/newfile.html
in your htaccess file
you can also make it a 301 or 302 redirect