As you can tell by the title of my post I am very new to php and any other language for that matter. I am trying to find an online source that can explain why it is that some URL's work that dont follow a folder structure. For example in wordpress after changing the linking structure from default query URL's in to custom permalink structure (/%category%/%postname%/). How is this done? Is this an apache thing or a php thing? If anyone could shed some light on this for me that would be greatly appreciated.
With WordPress it's both Apache and PHP. You can easily rewrite urls without php however. Google .htaccess rewrite for more info.
OK so I did some looking around and realized that apache can be very tough. If someone could direct me to an in depth source for a query mod rewrite or give a sample of the kind of code I should be learning to work with that would be a day maker for me. Thanks
Your right it can be very complicated, but then a lot of it is simply the syntax which when you break it down becomes a lot lot more logical. It's because mod_rewrite allows regular expressions that it looks so bizare and if you have a basic understanding of them it does help. Never found a definitive source, but there's a few promising tutorials in this Google link to mod_rewrite tutorials The essence to remember is that there are 2 things you can do within a rewrite. 1) RewriteCond is like a basic "If X = Y do Z" although annoyingly basic sometimes. 2) RewriteRule which is the bit which says something on the left changes to something on the right. Example: Going by what you were asking about, this is a quick example since personally I rarely worry about RewriteCond. RewriteRule ^/my-fake-directory/$ /myscripts/printer.php?fakedir=1 Code (markup): In this case the user would see www.example.com/my-fake-directory/ but the mod_rewrite catches that call and triggers the printer script under /myscripts/printer.php passing it the query string. It can seem to get complicated very quickly, but hopefully those tutorials will give you the basics and then you can just turn things around as you want. Trev