I’m probably breaking all the rules of eticate again, but this isn’t really CI related, so I popped it in the lounge. I need someone to ‘teach me how to fish’ 😊
I’m ( for the first time ) trying to get to grips with mod_rewrite. I’m hoping someone can offer some examples to get me going, and I can tweak them, but right now I’m at a brick wall. I think I’m ok with things like adding the www on the front and stuff, its just the more detailed rules I’m struggling with.
Heres what I want to do:
From the root, any number of letters or numbers followed by a slash and nothing else:
<a href="http://www.mysite.com/about/">http://www.mysite.com/about/</a>Remove the slash and replace with a .php:
<a href="http://www.mysite.com/about.php">http://www.mysite.com/about.php</a>*Except don’t rewrite a specified one, leave as is:
<a href="http://www.mysite.com/contact/">http://www.mysite.com/contact/</a>A similar thing for the products folder:
<a href="http://www.mysite.com/products/satellite/">http://www.mysite.com/products/satellite/</a>to
<a href="http://www.mysite.com/products/satellite.php">http://www.mysite.com/products/satellite.php</a>and finally:
<a href="http://www.mysite.com/products/satellite/rent/">http://www.mysite.com/products/satellite/rent/</a>to remove the end slash and swap with a .php, and replace /rent with -rent
<a href="http://www.mysite.com/products/satellite-rent.php">http://www.mysite.com/products/satellite-rent.php</a>I’m not asking for someone to just do this for me (ok so maybe I am), but I think if I’ve got a couple of examples, I’ll be able to see how its done. I’ve got a load more rules to add for things like url parameters, but I want to have a bash at those, hopefully with the knowledge I’m gained from these ones…