Archive for the 'htaccess' Category
Merging Bloggs!

Code labs is dead

Long live the Blogg

Code Labs is now Blogg

I’m merged my labs and blogg blogs together, frankly it was become way too much hassle for something i hardly update

 

thanks to mark for his use a different user post

For those wanting to do the same and redirect not lose too much seo/help users, here’s a quick htaccess snippet for you,

create a file in your old directory for me it was /labs, and create a file called .htaccess

{code}

RewriteEngine On
# redirect to new blog
RewriteRule ^(.*)$ /blogg/$1 [R=301,L]

{code}

of htaccess and query strings…

Oh how the months go by when your having fun, working hard, and being a manager…

ahhh

Anyway I had to fix this issue recently when one of the software engineers on the top-secret project I can’t talk about hit a problem,

Basically the htaccess documentation is a bit naff

see these links

which clearly states that the query string isn’t passed through to rewriterule …. ah yes really obvious… but after 2-3 mins of inspection it was obvious this was the correct place to check query string parameters which are stripped and put into a parameter
the core function of the standard apache htaccess file
So the basic query string modifications are done as follows
Stage 1 – isolate information in the query string using the power of regex
# so say your query string is ?cat=hello
# this should make the variable %1 equal to hello
RewriteCond %{QUERY_STRING} ^cat=(.*)$
Stage 2 – add this query string information into the rewrite
# so say your query string is ?cat=hello
# this should make the variable %1 equal to hello
RewriteCond %{QUERY_STRING} ^cat=(.*)$

# this should take the person to http://www.bbc.co.uk/hello/

RewriteRule .* http://www.bbc.co.uk/%1/
See example
(content of the .htaccess file)
hope this helps someone as i know it confused the hell out of the poor SE, also note the final htacces was rather alot more complex, than the wee sample above,
cheers
Zap
(while I’m here I’d like to apolognise to the poor author of sifr who i cornered in a pub recently and shouted at a bit, sorry i’ve been hanging out with a html/css crowd recently and they really don’t like what you’ve done to them, something about designers bullying them, like i was saying soooorrrrie…)