PDA

View Full Version : .htaccess variable question



mattk
11 Nov 2010, 09:34 PM
Hey guys.. I'm new here and thought this would be a good place to start.

I wanted to get have my .htaccess to start everything after the .com as a variable.

For example.
www.website.com/this/would/be/the/string

It would be one variable that would have a value of 'this/would/be/the/string'. I want it to read everything after the .com, no matter what characters are used, as a single variable.

Is this possible? If so, how would the htaccess file look?

Thanks in advance.

tivy
12 Nov 2010, 10:17 AM
If you're using Apache (and 99% of the world is), you can use URL rewriting with the module mod_rewrite. Unfortunately, I don't know much about URL rewriting, but here's a few pages I found online. Oh, and you'll need to also have a rudimentary understanding of Regex.


Mod_Rewrite Beginner's Guide: http://www.workingwith.me.uk/articles/scripting/mod_rewrite
Rewrite Documentation: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
Regex Documentation: http://www.regular-expressions.info/